feat: add AirShelf core implementation

This commit is contained in:
zyc
2026-06-05 10:21:40 +08:00
parent 2ba1058329
commit cfdcd84a30
252 changed files with 70828 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
from rest_framework import serializers
from .models import Notification
class NotificationSerializer(serializers.ModelSerializer):
type = serializers.CharField(source="notification_type", read_only=True)
unread = serializers.SerializerMethodField()
project_name = serializers.CharField(source="project.name", read_only=True)
class Meta:
model = Notification
fields = [
"id",
"type",
"notification_type",
"priority",
"title",
"brief",
"body",
"source",
"project",
"project_name",
"stage",
"owner_label",
"cost_label",
"related_url",
"is_read",
"unread",
"read_at",
"archived_at",
"metadata",
"created_at",
"updated_at",
]
read_only_fields = [
"id",
"type",
"project_name",
"read_at",
"archived_at",
"created_at",
"updated_at",
]
def get_unread(self, obj):
return not obj.is_read