feat(core): Add ticket_comment_category slash command

ref: #690 closes #600
This commit is contained in:
2025-03-17 15:40:56 +09:30
parent 20d979963a
commit 105e6509b0
4 changed files with 29 additions and 13 deletions

View File

@ -229,6 +229,14 @@ For this command to process the following conditions must be met:
item_type = TicketLinkedItem.Modules.TICKET_CATEGORY
elif model_type == 'ticket_comment_category':
from core.models.ticket.ticket_comment_category import TicketCommentCategory
model = TicketCommentCategory
item_type = TicketLinkedItem.Modules.TICKET_COMMENT_CATEGORY
return tuple([
model,

View File

@ -31,19 +31,20 @@ class TicketLinkedItem(TenancyObject):
class Modules(models.IntegerChoices):
CLUSTER = 1, 'Cluster'
CONFIG_GROUP = 2, 'Config Group'
DEVICE = 3, 'Device'
OPERATING_SYSTEM = 4, 'Operating System'
SERVICE = 5, 'Service'
SOFTWARE = 6, 'Software'
CLUSTER = 1, 'Cluster'
CONFIG_GROUP = 2, 'Config Group'
DEVICE = 3, 'Device'
OPERATING_SYSTEM = 4, 'Operating System'
SERVICE = 5, 'Service'
SOFTWARE = 6, 'Software'
KB = 7, 'Knowledge Base'
ORGANIZATION = 8, 'Organization'
TEAM = 9, 'Team'
FEATURE_FLAG = 10, 'Feature Flag'
SOFTWARE_VERSION = 11, 'Software Version'
TICKET_CATEGORY = 12, 'Ticket Category'
KB = 7, 'Knowledge Base'
ORGANIZATION = 8, 'Organization'
TEAM = 9, 'Team'
FEATURE_FLAG = 10, 'Feature Flag'
SOFTWARE_VERSION = 11, 'Software Version'
TICKET_CATEGORY = 12, 'Ticket Category'
TICKET_COMMENT_CATEGORY = 13, 'Ticket Comment Category'
is_global = None

View File

@ -8,6 +8,7 @@ from assistance.models.knowledge_base import KnowledgeBase
from config_management.models.groups import ConfigGroups
from core.models.ticket.ticket_category import TicketCategory
from core.models.ticket.ticket_comment_category import TicketCommentCategory
from core.serializers.ticket_linked_item import (
Ticket,
TicketLinkedItem,
@ -207,6 +208,12 @@ class ViewSet(ModelViewSet):
self.parent_model = TicketCategory
elif str(getattr(TicketLinkedItem.Modules, 'TICKET_COMMENT_CATEGORY').label).lower().replace(' ', '_') == self.kwargs['item_class']:
item_type = getattr(TicketLinkedItem.Modules, 'TICKET_COMMENT_CATEGORY').value
self.parent_model = TicketCommentCategory
self.item_type = item_type