Skip to content

Commit

Permalink
Добавлен эндпоинт для изменения флага админа
Browse files Browse the repository at this point in the history
  • Loading branch information
azazzze1 committed Dec 13, 2024
1 parent aca4c64 commit 5ea4d24
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions backend/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ def createEntities():
else:
return jsonify({"Error": "Invalid format of form"}), 400

@app.route('/api/set_admin', methods=['POST'])
def set_entity():
data : json = request.json
entity_mail : str = data.get('mail')
entity_admin : bool = data.get('flag')

if entity_mail and entity_admin:
query_string = f'''MATCH(p:Patient{{mail:'{entity_mail}'}})
SET p.admin = {entity_admin}
'''

conn.query(query_string)

return("Success")
else:
return jsonify({"error": "No mail or admin fields"}), 400



@app.route('/api/import_dump', methods=['POST'])
def import_dump():

Expand Down

0 comments on commit 5ea4d24

Please sign in to comment.