mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 17:30:30 +00:00
feat: 站内信 (#6183)
* 添加站内信 * s * s * 添加接口 * fix * fix * 重构了一些 * 完成 * 完善 * s * s * s * s * s * s * 测试ok * 替换业务中发送消息的方式 * 修改 * s * 去掉 update 兼容 create * 添加 unread total 接口 * 调整json字段 Co-authored-by: xinwen <coderWen@126.com>
This commit is contained in:
29
apps/notifications/serializers/notifications.py
Normal file
29
apps/notifications/serializers/notifications.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from common.drf.serializers import BulkModelSerializer
|
||||
from notifications.models import SystemMsgSubscription
|
||||
|
||||
|
||||
class SystemMsgSubscriptionSerializer(BulkModelSerializer):
|
||||
receive_backends = serializers.ListField(child=serializers.CharField())
|
||||
|
||||
class Meta:
|
||||
model = SystemMsgSubscription
|
||||
fields = (
|
||||
'message_type', 'message_type_label',
|
||||
'users', 'groups', 'receive_backends', 'receivers'
|
||||
)
|
||||
read_only_fields = (
|
||||
'message_type', 'message_type_label', 'receivers'
|
||||
)
|
||||
extra_kwargs = {
|
||||
'users': {'allow_empty': True},
|
||||
'groups': {'allow_empty': True},
|
||||
'receive_backends': {'required': True}
|
||||
}
|
||||
|
||||
|
||||
class SystemMsgSubscriptionByCategorySerializer(serializers.Serializer):
|
||||
category = serializers.CharField()
|
||||
category_label = serializers.CharField()
|
||||
children = SystemMsgSubscriptionSerializer(many=True)
|
Reference in New Issue
Block a user