Skip to content

Commit

Permalink
refactor(api): set fields that are for markdown to use the markdown f…
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Nov 11, 2024
1 parent 53ce9ca commit 3bad391
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/api/serializers/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

from rest_framework import serializers

from core import fields as centurion_field



class CommonBaseSerializer(serializers.ModelSerializer):

pass



class CommonModelSerializer(CommonBaseSerializer):

model_notes = centurion_field.MarkdownField( required = False )
8 changes: 8 additions & 0 deletions app/assistance/serializers/knowledge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from assistance.models.knowledge_base import KnowledgeBase
from assistance.serializers.knowledge_base_category import KnowledgeBaseCategoryBaseSerializer

from core import fields as centurion_field



class KnowledgeBaseBaseSerializer(serializers.ModelSerializer):

Expand Down Expand Up @@ -96,6 +99,11 @@ def get_url(self, item) -> dict:
}


content = centurion_field.MarkdownField( required = False )

summary = centurion_field.MarkdownField( required = False )


class Meta:

model = KnowledgeBase
Expand Down
3 changes: 3 additions & 0 deletions app/core/serializers/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from api.exceptions import UnknownTicketType

from core import exceptions as centurion_exception
from core import fields as centurion_field
from core.models.ticket.ticket import Ticket

from core.fields.badge import Badge, BadgeField
Expand Down Expand Up @@ -136,6 +137,8 @@ def get_url(self, item) -> dict:
return url_dict


description = centurion_field.MarkdownField( required = False )

duration = serializers.IntegerField(source='duration_ticket', read_only=True)

status_badge = BadgeField(label='Status')
Expand Down
4 changes: 4 additions & 0 deletions app/core/serializers/ticket_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from app.serializers.user import UserBaseSerializer

from core import exceptions as centurion_exceptions
from core import fields as centurion_field
from core.models.ticket.ticket_comment import Ticket, TicketComment


Expand Down Expand Up @@ -105,6 +106,9 @@ def get_url(self, item) -> dict:
return urls


body = centurion_field.MarkdownField( required = False )


class Meta:

model = TicketComment
Expand Down
3 changes: 3 additions & 0 deletions app/project_management/serializers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from access.serializers.teams import TeamBaseSerializer

from core import fields as centurion_field

from project_management.models.projects import Project
from project_management.serializers.project_states import ProjectStateBaseSerializer
from project_management.serializers.project_type import ProjectTypeBaseSerializer
Expand Down Expand Up @@ -75,6 +77,7 @@ def get_url(self, item) -> dict:
),
}

description = centurion_field.MarkdownField( required = False )

class Meta:

Expand Down

0 comments on commit 3bad391

Please sign in to comment.