From 4faafb8d27944c7e5f298842f32d49ba7abd3903 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 9 Jan 2025 02:21:34 +0930 Subject: [PATCH] feat(core): Add ticket linked item field metadata to api meta ref: #466 #467 nofusscomputing/centurion_erp_ui#40 --- app/core/serializers/ticket_linked_item.py | 4 ++++ app/core/viewsets/ticket_linked_item.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/core/serializers/ticket_linked_item.py b/app/core/serializers/ticket_linked_item.py index 5bf41f206..a47a02469 100644 --- a/app/core/serializers/ticket_linked_item.py +++ b/app/core/serializers/ticket_linked_item.py @@ -6,6 +6,7 @@ from assistance.serializers.request import TicketBaseSerializer +from core import fields as centurion_field from core.fields.badge import BadgeField from core.models.ticket.ticket import Ticket from core.models.ticket.ticket_linked_items import TicketLinkedItem @@ -54,6 +55,8 @@ class TicketLinkedItemModelSerializer( ): + display_name = centurion_field.MarkdownField(source='__str__', required = True ) + _urls = serializers.SerializerMethodField('get_url') def get_url(self, item) -> dict: @@ -158,6 +161,7 @@ class TicketLinkedItemViewSerializer(TicketLinkedItemModelSerializer): item = serializers.SerializerMethodField('get_item') + def get_item(self, item) -> dict: base_serializer: dict = None diff --git a/app/core/viewsets/ticket_linked_item.py b/app/core/viewsets/ticket_linked_item.py index 9183bb46e..74f5c39d1 100644 --- a/app/core/viewsets/ticket_linked_item.py +++ b/app/core/viewsets/ticket_linked_item.py @@ -125,6 +125,8 @@ class ViewSet(ModelViewSet): search_fields = [] + metadata_markdown = True + model = TicketLinkedItem