#NEWLINE# @ bp . route ( '/<int:uid>/like' , methods = ( 'POST' , ) ) #NEWLINE# @ require_user #NEWLINE# def like( uid ) : #NEWLINE# #INDENT# 'Like a topic.' #NEWLINE# like = LikeTopic . query . filter_by ( account_id = g . user . id , topic_id = uid ) . first ( ) #NEWLINE# if like : #NEWLINE# #INDENT# db . session . delete ( like ) #NEWLINE# db . session . commit ( ) #NEWLINE# return jsonify ( status = 'ok' , action = 'cancel' ) #NEWLINE# #UNINDENT# like = LikeTopic ( account_id = g . user . id , topic_id = like ) #NEWLINE# db . session . add ( like ) #NEWLINE# db . session . commit ( ) #NEWLINE# return jsonify ( status = 'ok' , action = 'like' )