class ChatSessionSerializers(serializers.ModelSerializer): creator = OwnerSerializer(many=False, read_only=True) invited_user = OwnerSerializer(many=False, read_only=True) # post = PostSerializers(many=False, read_only=True) class Meta: model = ChatSession fields = ['id', 'uri', 'creator', 'invited_user']
class LikeSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) post = PostSerializers(many=False, read_only=True) class Meta: model = Like fields = ['user', 'post']
class CommentLikeSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) comment = CommentSerializers(many=False, read_only=True) class Meta: model = CommentLike fields = ['user', 'comment']
class ChatMessageSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) chat_session = ChatSessionSerializers(many=False, read_only=True) class Meta: model = ChatSessionMessage fields = ['id', 'user', 'text', 'chat_session', 'create_date', 'update_date', 'image', 'received', 'seen']
class CommentRepliesSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) # post = PostSerializers(many=False, read_only=True) class Meta: model = CommentReplies fields = ['user', 'image', 'text', 'id', 'created_at', 'comment']
class PostSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) likes = CountLikeSerializers(many=True, read_only=True) comments = CommentSerializers(many=True, read_only=True) class Meta: model = Post fields = [ 'comments', 'id', 'content', 'created_at', 'image', 'user', 'likes' ]
class CommentSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) commentReplies = CommentRepliesSerializers(many=True, read_only=True) commentlikes = CountCommentLikeSerializers(many=True, read_only=True) class Meta: model = Comment fields = [ 'user', 'image', 'text', 'id', 'created_at', 'commentlikes', 'commentReplies' ]
class CountLikeSerializers(serializers.ModelSerializer): user = OwnerSerializer(many=False, read_only=True) class Meta: model = Like fields = ['post', 'user']