[SILO-596] Add missing fields in published apps endpoint (#4421)
* add new fields to get marketplace apps + fix fixtures * rename application count field
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
},
|
||||
{
|
||||
"model": "authentication.applicationcategory",
|
||||
"pk": "6f778616-3839-4910-8626-aa6948556826",
|
||||
"pk": "6ab2cc94-4c88-4c69-bd9e-f22970b04e6a",
|
||||
"fields": {
|
||||
"created_at": "2024-01-09T10:22:30.575Z",
|
||||
"updated_at": "2024-01-09T10:22:30.575Z",
|
||||
@@ -161,7 +161,7 @@
|
||||
},
|
||||
{
|
||||
"model": "authentication.applicationcategory",
|
||||
"pk": "6f778616-3839-4910-8626-aa6948556826",
|
||||
"pk": "4e2a4e83-70fa-4d95-8ca3-41ffdd342f75",
|
||||
"fields": {
|
||||
"created_at": "2024-01-09T10:22:30.575Z",
|
||||
"updated_at": "2024-01-09T10:22:30.575Z",
|
||||
|
||||
@@ -28,6 +28,10 @@ class PublishedApplicationSerializer(serializers.ModelSerializer):
|
||||
"configuration_url",
|
||||
"video_url",
|
||||
"attachments",
|
||||
"supported_environments",
|
||||
"supported_plans",
|
||||
"links",
|
||||
"website",
|
||||
]
|
||||
|
||||
def get_attachments(self, obj):
|
||||
@@ -45,9 +49,14 @@ class PublishedApplicationSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class ApplicationCategorySerializer(serializers.ModelSerializer):
|
||||
applications_count = serializers.SerializerMethodField()
|
||||
class Meta:
|
||||
model = ApplicationCategory
|
||||
fields = ["id", "name", "description", "logo_props", "is_active"]
|
||||
fields = ["id", "name", "description", "logo_props", "is_active", "applications_count"]
|
||||
|
||||
def get_applications_count(self, obj):
|
||||
# send only count of applications that are published
|
||||
return obj.applications.filter(published_at__isnull=False).count()
|
||||
|
||||
|
||||
class ApplicationTemplateMetaSerializer(serializers.ModelSerializer):
|
||||
|
||||
Reference in New Issue
Block a user