def getPostsByDate(pdate): if request.method == 'GET': return PostHandler().getPostsByDate(pdate) elif request.method == 'PUT': return PostHandler().updatePost(pdate, request.form) elif request.method == 'DELETE': return PostHandler().deletePost(pdate) else: return jsonify(Error="Method not allowed."), 405
def getAllPosts(): if request.method == 'POST': print("REQUEST: ", request.json) return PostHandler().insertPostJson(request.json) else: if not request.args: return PostHandler().getAllPosts() else: return PostHandler().searchPosts(request.args)
def getPostsByUser(uid): return PostHandler().getPostsByUser(uid)
def getAllPostsWebsite(): return PostHandler().getAllPostWebsite()
def addReaction(pid, reaction): if request.method == 'GET': print(reaction) return PostHandler().getReactionsByPost(pid, reaction) else: return jsonify(Error="Method not allowed."), 405
def getNumberOfPostReplies(): return PostHandler().getNumberOfPostReplies()
def getRepliesPerDay(): return PostHandler().getNumberOfRepliesPerDay()
def postPost(): return PostHandler().insertPost(request.json)
def reply(post): return PostHandler().getAllReplies(post)
def getNumberOfPostsPerDay(): return PostHandler().getNumberOfPostsPerDay()
def getActiveUsers(): return PostHandler().getActiveUsers()
def getPostsPerDayByUser(uid): return PostHandler().getPostsPerDayByUser(uid)
def replyPost(pid): return PostHandler().insertPostReplyJson(request.json, pid)
def getPostsByChatId(cid): return PostHandler().getPostsByChatId(cid)
def insert(): return PostHandler().insertPostJson(request.json)
def getPostsByChatIdAndUser(cid, uid): return PostHandler().getPostsByChatIdAndUser(cid, uid)
def postsByHashtag(cid, hashtag): return PostHandler().getPostsByHashtag(cid, hashtag)