Files

31 lines
814 B
Python
Raw Permalink Normal View History

2026-04-03 23:51:00 +03:30
from rest_framework import serializers
2026-04-05 00:57:25 +03:30
from .models import FarmNotification
2026-04-03 23:51:00 +03:30
2026-04-05 00:57:25 +03:30
class FarmNotificationSerializer(serializers.ModelSerializer):
2026-04-29 02:58:56 +03:30
id = serializers.IntegerField(read_only=True)
2026-04-05 00:57:25 +03:30
farm_uuid = serializers.UUIDField(source="farm.farm_uuid", read_only=True)
2026-04-05 04:20:58 +03:30
since_id = serializers.IntegerField(source="id", read_only=True)
2026-04-05 00:57:25 +03:30
class Meta:
model = FarmNotification
fields = [
2026-04-29 02:58:56 +03:30
"id",
2026-04-05 00:57:25 +03:30
"uuid",
"farm_uuid",
2026-04-05 04:20:58 +03:30
"since_id",
2026-04-29 02:58:56 +03:30
"endpoint",
2026-04-05 00:57:25 +03:30
"title",
"message",
"level",
2026-04-29 02:58:56 +03:30
"suggested_action",
"source_alert_id",
"source_metric_type",
"payload",
2026-04-05 00:57:25 +03:30
"is_read",
"metadata",
"created_at",
2026-04-29 02:58:56 +03:30
"updated_at",
2026-04-05 00:57:25 +03:30
]