feat(core): migrations for TicketCommentBase

ref: #724 #726
This commit is contained in:
2025-04-16 21:01:22 +09:30
parent 64144ea76f
commit ddebf50e88

View File

@ -0,0 +1,51 @@
# Generated by Django 5.1.8 on 2025-04-16 11:28
import access.fields
import access.models.tenancy
import core.lib.slash_commands
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('access', '0005_entity_person_entityhistory_entitynotes_role_and_more'),
('core', '0022_ticketbase'),
]
operations = [
migrations.CreateModel(
name='TicketCommentBase',
fields=[
('id', models.AutoField(help_text='Comment ID Number', primary_key=True, serialize=False, unique=True, verbose_name='Number')),
('external_ref', models.IntegerField(blank=True, default=None, help_text='External System reference', null=True, verbose_name='Reference Number')),
('external_system', models.IntegerField(blank=True, choices=[(1, 'Github'), (2, 'Gitlab'), (9999, 'Custom #1 (Imported)'), (9998, 'Custom #2 (Imported)'), (9997, 'Custom #3 (Imported)'), (9996, 'Custom #4 (Imported)'), (9995, 'Custom #5 (Imported)'), (9994, 'Custom #6 (Imported)'), (9993, 'Custom #7 (Imported)'), (9992, 'Custom #8 (Imported)'), (9991, 'Custom #9 (Imported)')], default=None, help_text='External system this item derives', null=True, verbose_name='External System')),
('comment_type', models.CharField(default='ticket_comment', help_text='Type this comment is. derived from Meta.verbose_name', max_length=30, verbose_name='Type')),
('body', models.TextField(help_text='Comment contents', verbose_name='Comment')),
('private', models.BooleanField(default=False, help_text='Is this comment private', verbose_name='Private')),
('duration', models.IntegerField(default=0, help_text='Time spent in seconds', verbose_name='Duration')),
('estimation', models.IntegerField(default=0, help_text='Time estimation in seconds', verbose_name='Estimate')),
('is_template', models.BooleanField(default=False, help_text='Is this comment a template', verbose_name='Template')),
('source', models.IntegerField(choices=[(1, 'Direct'), (2, 'E-Mail'), (3, 'Helpdesk'), (4, 'Phone'), (5, 'Service Catalog'), (6, 'SMS Message')], default=3, help_text='Origin type for this comment', verbose_name='Source')),
('is_closed', models.BooleanField(default=False, help_text='Is this comment considered Closed?', verbose_name='Comment Closed')),
('date_closed', models.DateTimeField(blank=True, help_text='Date ticket closed', null=True, verbose_name='Closed Date')),
('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of creation', verbose_name='Created')),
('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of last modification', verbose_name='Modified')),
('category', models.ForeignKey(blank=True, default=None, help_text='Category of the comment', null=True, on_delete=django.db.models.deletion.PROTECT, to='core.ticketcommentcategory', verbose_name='Category')),
('organization', models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Organization')),
('parent', models.ForeignKey(blank=True, default=None, help_text='Parent ID for creating discussion threads', null=True, on_delete=django.db.models.deletion.PROTECT, to='core.ticketcommentbase', verbose_name='Parent Comment')),
('template', models.ForeignKey(blank=True, default=None, help_text='Comment Template to use', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='comment_template', to='core.ticketcommentbase', verbose_name='Template')),
('ticket', models.ForeignKey(help_text='Ticket this comment belongs to', on_delete=django.db.models.deletion.PROTECT, to='core.ticketbase', verbose_name='Ticket')),
('user', models.ForeignKey(help_text='Who made the comment', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='comment_user', to='access.entity', verbose_name='User')),
],
options={
'verbose_name': 'Ticket Comment',
'verbose_name_plural': 'Ticket Comments',
'ordering': ['id'],
'unique_together': {('external_system', 'external_ref')},
},
bases=(core.lib.slash_commands.SlashCommands, models.Model),
),
]