Exemplo n.º 1
0
    def validate(self, data):
        current_user = self.context['request'].current_user
        chat_messages = functions.list_chats(current_user.uuid)

        chat_messages_json = serializer_to_json(ListChatsSerializer,
                                                chat_messages)

        return chat_messages_json
Exemplo n.º 2
0
    def list(self, request, *args, **kwargs):
        user = self.request.current_user
        message = 'Successfully Retrieved Posts for {}'.format(user.user_name)
        posts = PostDocument.objects.filter(
            posted_by=user.uuid).order_by('-created_on')

        posts = serializer_to_json(ListPostsSerializer, posts)

        result = {'user_uuid': user.uuid, 'posts': posts}
        return self.get_response(message=message, result=result)
Exemplo n.º 3
0
    def validate(self, data):
        chat_uuid = data.get('chat_uuid', None)

        current_user = self.context['request'].current_user
        chat_messages = functions.show_messages(chat_uuid, current_user.uuid)

        chat_messages_json = serializer_to_json(ListChatMessagesSerializer,
                                                chat_messages)

        return chat_messages_json
Exemplo n.º 4
0
    def list(self, request, *args, **kwargs):
        user = self.request.current_user
        interests_list = serializer_to_json(ListInterestSerializer, user.interests.all())
        message = 'Successfully Retrieved Interests for user {}'.format(user.user_name)

        return self.get_response(message=message, result=interests_list)
Exemplo n.º 5
0
    def list(self, request, *args, **kwargs):
        interests_list = serializer_to_json(ListInterestSerializer, Interest.nodes.all())
        message = 'Successfully Retrieved All Interests!'

        return self.get_response(message=message, result=interests_list)
Exemplo n.º 6
0
    def list(self, request, *args, **kwargs):
        user = self.request.current_user
        interests_list = serializer_to_json(ListUsersSerializer, user.get_followed)
        message = 'Successfully Retrieved Followed users for {}'.format(user.user_name)

        return self.get_response(message=message, result=interests_list)