Пример #1
0
def getTrendingHashtags():
    tophashtags = []
    hashtags = dao.getTrendingHashtags()
    for row in hashtags:
        result = Dict.dashboard_hashtag_dict(row)
        tophashtags.append(result)
    return jsonify(Hashtags=tophashtags)
Пример #2
0
def getPostsByChatIDForUI(chat_id):
    chat_post_messages = dao.getPostsByChatID(chat_id)
    result_post_messages = []
    for row in chat_post_messages:
        result_post_messages.append(
            Dict.post_msg_chat_dict_UI_2(row, getRepliesByPostIDForUI(row[1])))
    return jsonify(PostsInChat=result_post_messages)
Пример #3
0
def getUserContactsByID(user_id):
    result = dao.getUserContactsByID(user_id)
    if not result:
        return jsonify(Error="No Contacts Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.contacts_dict(row))
    return jsonify(UserContacts=mapped_result)
Пример #4
0
def getAllPost():
    rows = dao.getAllPosts()
    if not rows:
        return jsonify(Error="No Message found"), 404
    result = []
    for row in rows:
        result.append(Dict.post_dict(row))
    return jsonify(Posts=result)
Пример #5
0
def getUserActivity(user_id):
    result = dao.getUserActivity(user_id)
    if not result:
        return jsonify(Error="No Activity Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.activity_dict(row))
    return jsonify(UserActivity=result)
Пример #6
0
def getAllUsers():
    result = dao.getAllUsers()
    if not result:
        return jsonify(Error="No Users Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.user_dict(row))
    return jsonify(Users=mapped_result)
Пример #7
0
def getAllCredentials():
    result = dao.getAllCredentials()
    if not result:
        return jsonify(Error="No Credentials Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.credential_dict(row))
    return jsonify(Credentials=mapped_result)
Пример #8
0
def getAllActivity():
    result = dao.getAllActivity()
    if not result:
        return jsonify(Error="No Activity Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.activity_dict(row))
    return jsonify(Activity=mapped_result)
Пример #9
0
def getChatByUserID(user_id):
    rows = dao.getChatByUserID(user_id)
    if not rows:
        return jsonify(Error="No Chats found"), 404
    result = []
    for row in rows:
        result.append(Dict.chat_dict(row))
    return jsonify(Chats=result)
Пример #10
0
def getUsersWhoDislikedPost(post_id):
    result = dao.getUsersWhoDislikedPost(post_id)
    if not result:
        return jsonify(Error="No Users Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.reaction_user_dict(row))
    return jsonify(UsersDislikedPost=mapped_result)
Пример #11
0
def getUsersByChatID(chat_id):
    result = dao.getUsersByChatID(chat_id)
    if not result:
        return jsonify(Error="No Users Found"), 404
    mapped_result = []
    for row in result:
        mapped_result.append(Dict.chat_participants_dict(row))
    return jsonify(Users=mapped_result)
Пример #12
0
def getRepliesByPostID(post_id):
    replies_info = dao.getRepliesByPostID(post_id)
    if not replies_info:
        return jsonify(Error="No Replies Found"), 404
    result_replies = []
    for row in replies_info:
        result = Dict.reply_dict(row)
        result_replies.append(result)
    return jsonify(Replies=result_replies)
Пример #13
0
def getPostsByChatID(chat_id):
    chat_post_messages = dao.getPostsByChatID(chat_id)
    if not chat_post_messages:
        return jsonify(Error="No Messages Found")
    result_post_messages = []
    for row in chat_post_messages:
        result = Dict.post_msg_chat_dict_UI(row)
        result_post_messages.append(result)
    return jsonify(PostsInChat=result_post_messages)
Пример #14
0
def getPostPerDay():
    postsPerDay = dao.getPostPerDay()
    result_list = []

    for row in postsPerDay:
        result = Dict.post_per_day_dict(row)
        result_list.append(result)

    return jsonify(PostsPerDay=result_list)
Пример #15
0
def getMediaByPostID(post_id):
    media_info = dao.getMediaByPostID(post_id)
    if not media_info:
        return jsonify(Error="No Messages Found"), 404
    result_media = []
    for row in media_info:
        result = Dict.media_dict(row)
        result_media.append(result)
    return jsonify(Media=result_media)
Пример #16
0
def getAllChats():
    chat_lists = dao.getAllChats()
    if not chat_lists:
        return jsonify(Error="No Chats Found")
    result_list = []

    for row in chat_lists:
        result = Dict.chat_dict(row)
        result_list.append(result)
    return jsonify(Chats=result_list)
Пример #17
0
def getUserInfo(user_id):
    result = dao.getUserInfo(user_id)
    if not result:
        return jsonify(Error="No User Found"), 404
    result = Dict.user_dict(result)
    return jsonify(UserInfo=result)
Пример #18
0
def getAdminByChatID(chat_id):
    result = dao.getAdminByChatID(chat_id)
    if not result:
        return jsonify(Error="No Admin Found"), 404
    mapped_result = Dict.chat_admin_dict(result)
    return jsonify(Admin=mapped_result)
Пример #19
0
def getRepliesByPostIDForUI(post_id):
    replies_info = dao.getRepliesByPostID(post_id)
    result_replies = []
    for row in replies_info:
        result_replies.append(Dict.reply_dict(row))
    return result_replies