Beispiel #1
0
def getChatMessagesOfUser(group_id, user_id):
    handler = MessageHandler()
    mHandler = MembershipHandler()

    # JSON FORMAT
    # json = { "message_text": }

    if request.method == 'POST':
        #pre: group already exits
        #pre: user already exits
        print(mHandler.checkMember(group_id, user_id))
        if (mHandler.checkMember(group_id, user_id)
                is not None):  # check if user is a member
            return handler.sendMessage(
                request.json, user_id,
                group_id)  # parameters admin id and group id

        else:
            return jsonify(Error="User not member of group."), 405

    elif request.method == 'GET':
        return handler.findGroupMessagesByUser(group_id, user_id)
    else:
        return jsonify(Error="Method not allowed."), 405
Beispiel #2
0
def getNumofLikesbyMessageID(mID):
    return MessageHandler().getNumofLikesbyMessageID(mID)
Beispiel #3
0
def getChatMessages(group_id):
    handler = MessageHandler()
    return handler.findGroupMessages(group_id)
Beispiel #4
0
def getMessageById(message_id):
    handler = MessageHandler()
    return handler.getMessageByID(message_id)
Beispiel #5
0
def messageCount():
    handler = MessageHandler()
    return handler.getMessagesPerDay()
Beispiel #6
0
def getMessageByHashtagAndGroup(group_id, hashtag_text):
    handler = MessageHandler()
    hHandler = HashtagsHandler()
    hashtag_text = '#' + hashtag_text  # concat the # to the hashtag text
    return hHandler.getMessagesWithHashtagTextAndGroup(hashtag_text, group_id)
Beispiel #7
0
def getMessages():
    print('db')
    handler = MessageHandler()
    return handler.getAllMessages()
Beispiel #8
0
def getMessageByID(mID):
    return MessageHandler().getMessageById(mID)
Beispiel #9
0
def getRepliesByMessageID(mID):
    return MessageHandler().getRepliesByMessageID(mID)
Beispiel #10
0
def getReactsByMessageID(mID):
    return MessageHandler().getReactsByMessageID(mID)
Beispiel #11
0
def dislikeMessage(mID, pID):
    return MessageHandler().dislikeMessage(pID, mID)
Beispiel #12
0
def likeMessage(mID, pID):
    return MessageHandler().likeMessage(pID, mID)
Beispiel #13
0
def getPersonWhoDisikedMessageID(mID):
    return MessageHandler().getPersonWhoDisikedMessageID(mID)
Beispiel #14
0
def getNumofDislikesbyMessageID(mID):
    return MessageHandler().getNumOfDislikesMessageID(mID)
Beispiel #15
0
def getMessages():
    if request.method == 'GET':
        return MessageHandler().getAllMessages()
    elif request.method == 'POST':
        print(request)
        return MessageHandler().addMessage(request.json)
Beispiel #16
0
def addMessageAsReply(mID):
    return MessageHandler().addMessageAsReply(mID, request.json)
Beispiel #17
0
def getOriginalMessageByReplyID(mID):
    return MessageHandler().getOriginalMessageByReplyID(mID)
Beispiel #18
0
def getChatMessages(group_id):
    handler = MessageHandler()
    return handler.findGroupMessages(
        group_id)  # form #returns users info added
Beispiel #19
0
def getMessagesWithHashtagInGroupID(ht, gID):
    return MessageHandler().getMessagesWithHashtagInGroupID(ht, gID)
Beispiel #20
0
def getMessageByHashtag(hashtag_text):
    handler = MessageHandler()
    hHandler = HashtagsHandler()
    hashtag_text = '#' + hashtag_text  # concat the # to the hashtag text
    return hHandler.getMessagesWithHashtagText(hashtag_text)
Beispiel #21
0
def getMessagesPerDay():
    return MessageHandler().getNumOfMessagesPerDay()
Beispiel #22
0
def getRepliesPerDay():
    return MessageHandler().getNumOfRepliesPerDay()
Beispiel #23
0
def getLikesPerDay():
    return MessageHandler().getNumOfLikesPerDay()
Beispiel #24
0
def getMessages():
    handler = MessageHandler()
    return handler.getAllMessages()
Beispiel #25
0
def getDislikesPerDay():
    return MessageHandler().getNumOfDislikesPerDay()
Beispiel #26
0
def getMessagesByUID(user_id):
    handler = MessageHandler()
    return handler.findUserMessages(user_id)
Beispiel #27
0
def getNumOfActiveUsersPerDay():
    return MessageHandler().getNumOfActiveUsersPerDay()
Beispiel #28
0
def getChatMessagesOfUser(group_id, user_id):
    handler = MessageHandler()
    return handler.findGroupMessagesByUser(group_id, user_id)
Beispiel #29
0
def getMessagesPostedByPersoninGroupID(gID, pID):
    return MessageHandler().getMessagesPostedByPersoninGroupID(pID, gID)