[WEB-5845] chore: changing description field to description json (#8230)
* chore: migrating description to description json * chore: replace description with description_json * chore: updated migration file * chore: updated the migration file * chore: added description key in external endpoint * chore: updated the migration file * chore: updated the typo --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
parent
6c8779c8d3
commit
2a29ab8d4a
26 changed files with 85 additions and 54 deletions
|
|
@ -53,7 +53,7 @@ class IssueFlatSerializer(BaseSerializer):
|
|||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"description_json",
|
||||
"description_html",
|
||||
"priority",
|
||||
"start_date",
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class PageSerializer(BaseSerializer):
|
|||
labels = validated_data.pop("labels", None)
|
||||
project_id = self.context["project_id"]
|
||||
owned_by_id = self.context["owned_by_id"]
|
||||
description = self.context["description"]
|
||||
description_json = self.context["description_json"]
|
||||
description_binary = self.context["description_binary"]
|
||||
description_html = self.context["description_html"]
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class PageSerializer(BaseSerializer):
|
|||
# Create the page
|
||||
page = Page.objects.create(
|
||||
**validated_data,
|
||||
description=description,
|
||||
description_json=description_json,
|
||||
description_binary=description_binary,
|
||||
description_html=description_html,
|
||||
owned_by_id=owned_by_id,
|
||||
|
|
@ -171,7 +171,7 @@ class PageBinaryUpdateSerializer(serializers.Serializer):
|
|||
|
||||
description_binary = serializers.CharField(required=False, allow_blank=True)
|
||||
description_html = serializers.CharField(required=False, allow_blank=True)
|
||||
description = serializers.JSONField(required=False, allow_null=True)
|
||||
description_json = serializers.JSONField(required=False, allow_null=True)
|
||||
|
||||
def validate_description_binary(self, value):
|
||||
"""Validate the base64-encoded binary data"""
|
||||
|
|
@ -214,8 +214,8 @@ class PageBinaryUpdateSerializer(serializers.Serializer):
|
|||
if "description_html" in validated_data:
|
||||
instance.description_html = validated_data.get("description_html")
|
||||
|
||||
if "description" in validated_data:
|
||||
instance.description = validated_data.get("description")
|
||||
if "description_json" in validated_data:
|
||||
instance.description_json = validated_data.get("description_json")
|
||||
|
||||
instance.save()
|
||||
return instance
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ class IntakeIssueViewSet(BaseViewSet):
|
|||
issue_data = {
|
||||
"name": issue_data.get("name", issue.name),
|
||||
"description_html": issue_data.get("description_html", issue.description_html),
|
||||
"description": issue_data.get("description", issue.description),
|
||||
"description_json": issue_data.get("description_json", issue.description_json),
|
||||
}
|
||||
|
||||
issue_current_instance = json.dumps(IssueDetailSerializer(issue).data, cls=DjangoJSONEncoder)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class PageViewSet(BaseViewSet):
|
|||
context={
|
||||
"project_id": project_id,
|
||||
"owned_by_id": request.user.id,
|
||||
"description": request.data.get("description", {}),
|
||||
"description_json": request.data.get("description_json", {}),
|
||||
"description_binary": request.data.get("description_binary", None),
|
||||
"description_html": request.data.get("description_html", "<p></p>"),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue