Skip to content

Commit

Permalink
feat(core): Link KB to ticket
Browse files Browse the repository at this point in the history
ref: #274 #426
  • Loading branch information
jon-nfc committed Dec 19, 2024
1 parent cc98966 commit 85914f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/core/lib/slash_commands/linked_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def command_linked_model(self, match) -> str:
Slash command usage within a ticket description will add an action comment with the
time spent. For a ticket comment, it's duration field is set to the duration valuee calculated.
Adding a new item to be linked also requires that you update the `__str__` function within
`core.models.ticket.ticket_linked_item.TicketLinkedItem`
Args:
match (re.Match): Named group matches
Expand Down Expand Up @@ -89,6 +92,14 @@ def command_linked_model(self, match) -> str:

item_type = TicketLinkedItem.Modules.DEVICE

elif model_type == 'kb':

from assistance.models.knowledge_base import KnowledgeBase

model = KnowledgeBase

item_type = TicketLinkedItem.Modules.KB

elif model_type == 'operating_system':

from itam.models.operating_system import OperatingSystem
Expand Down
6 changes: 6 additions & 0 deletions app/core/models/ticket/ticket_linked_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Modules(models.IntegerChoices):
SERVICE = 5, 'Service'
SOFTWARE = 6, 'Software'

KB = 7, 'Knowledge Base Article'

is_global = None

model_notes = None
Expand Down Expand Up @@ -113,6 +115,10 @@ def __str__(self) -> str:

item_type = 'device'

elif self.item_type == TicketLinkedItem.Modules.KB:

item_type = 'kb'

elif self.item_type == TicketLinkedItem.Modules.OPERATING_SYSTEM:

item_type = 'operating_system'
Expand Down

0 comments on commit 85914f4

Please sign in to comment.