forked from rDrama/rDrama
sdfsfd
parent
ff79ad4140
commit
a60c4873b1
|
@ -20,7 +20,9 @@ beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSH
|
||||||
@app.get("/@<username>/upvoters")
|
@app.get("/@<username>/upvoters")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def upvoters(v, username):
|
def upvoters(v, username):
|
||||||
id = g.db.query(User.id).filter(User.username==username).first()[0]
|
id = g.db.query(User.id).filter(User.username==username).first()
|
||||||
|
if not id: abort(400)
|
||||||
|
id = id[0]
|
||||||
|
|
||||||
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all()
|
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all()
|
||||||
|
|
||||||
|
@ -39,7 +41,9 @@ def upvoters(v, username):
|
||||||
@app.get("/@<username>/downvoters")
|
@app.get("/@<username>/downvoters")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def downvoters(v, username):
|
def downvoters(v, username):
|
||||||
id = g.db.query(User.id).filter(User.username==username).first()[0]
|
id = g.db.query(User.id).filter(User.username==username).first()
|
||||||
|
if not id: abort(400)
|
||||||
|
id = id[0]
|
||||||
|
|
||||||
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all()
|
votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue