def reply():
    if request.method == 'POST':
        User.registerActivity()
        result = Post.reply(request.json)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def createPost():
    if request.method == 'POST':
        if allowed_file(request.files['file'].filename):
            User.registerActivity()
            return Post.createPost(request.form, request.files['file'],
                                   app.config['UPLOAD_FOLDER'])
        return jsonify(Error="File extension not allowed"), 405
    return jsonify(Error="Method not allowed"), 405
def getUserContactsByID(user_id):
    if request.method == 'GET':
        result = User.getUserContactsByID(user_id)
        return result
    elif request.method == 'POST':
        result = User.addContacts(request.json)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getUserByID(user_id):
    if request.method == 'GET':
        result = User.getUserInfo(user_id)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getAllUsersNotSession():
    if request.method == 'GET':
        result = User.getAllUsersNotSession()
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def login():
    if request.method == 'POST':
        result = User.login(request.json)
        return result
    return jsonify(Error="Method not allowed."), 405
def register():
    if request.method == 'POST':
        return User.register(request.json)
    return jsonify(Error="Method not allowed."), 405
def createChat():
    if request.method == 'POST':
        User.registerActivity()
        return Chat.createChat(request.json)
    return jsonify(Error="Method not allowed."), 405
def getAllActivities():
    if request.method == 'GET':
        result = User.getAllActivity()
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getCredentials():
    if request.method == 'GET':
        result = User.getAllCredentials()
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getAdminByChatID(chat_id):
    if request.method == 'GET':
        result = User.getAdminByChatID(chat_id)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getUsersWhoDislikedPost(post_id):
    if request.method == 'GET':
        result = User.getUsersWhoDislikedPost(post_id)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405
def getUserByUsername(username):
    if request.method == 'GET':
        result = User.getUserByUsername(username)
        return result
    else:
        return jsonify(Error="Method not allowed"), 405