You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/notifications/serializers/site_msgs.py

29 lines
935 B

from rest_framework.serializers import ModelSerializer
from rest_framework import serializers
from ..models import SiteMessage
class SiteMessageListSerializer(ModelSerializer):
class Meta:
model = SiteMessage
fields = ['id', 'subject', 'has_read', 'read_at']
class SiteMessageRetrieveSerializer(ModelSerializer):
class Meta:
model = SiteMessage
fields = ['id', 'subject', 'message', 'has_read', 'read_at']
class SiteMessageIdsSerializer(serializers.Serializer):
ids = serializers.ListField(child=serializers.UUIDField())
class SiteMessageSendSerializer(serializers.Serializer):
subject = serializers.CharField()
message = serializers.CharField()
user_ids = serializers.ListField(child=serializers.UUIDField(), required=False)
group_ids = serializers.ListField(child=serializers.UUIDField(), required=False)
is_broadcast = serializers.BooleanField(default=False)