mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-02-02 13:49:40 +01:00
Testing a simple API
This commit is contained in:
parent
3b08f2e08c
commit
83b033a779
@ -131,7 +131,13 @@ def create_album():
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return redirect(f"/albums/{uuid}")
|
if "response" in request.args and request.args["response"] == "json":
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"uuid": uuid
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return redirect(f"/albums/{uuid}")
|
||||||
|
|
||||||
flash(error)
|
flash(error)
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
@ -291,8 +297,14 @@ def add_partition(album_uuid):
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
flash(f"Partition {request.form['name']} ajoutée")
|
if "response" in request.args and request.args["response"] == "json":
|
||||||
return redirect(f"/albums/{album.uuid}")
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"uuid": partition_uuid
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
flash(f"Partition {request.form['name']} ajoutée")
|
||||||
|
return redirect(f"/albums/{album.uuid}")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/add-partition", methods=["POST"])
|
@bp.route("/add-partition", methods=["POST"])
|
||||||
|
@ -89,7 +89,13 @@ def create_groupe():
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return redirect(f"/groupe/{uuid}")
|
if "response" in request.args and request.args["response"] == "json":
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"uuid": uuid
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return redirect(f"/groupe/{uuid}")
|
||||||
|
|
||||||
flash(error)
|
flash(error)
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
|
@ -99,8 +99,14 @@ def add_attachment(uuid):
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
return redirect(f"/partition/{partition.uuid}/attachments")
|
if "response" in request.args and request.args["response"] == "json":
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"uuid": attachment_uuid
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return redirect(f"/partition/{partition.uuid}/attachments")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/attachment/<uuid>.<filetype>")
|
@bp.route("/attachment/<uuid>.<filetype>")
|
||||||
|
Loading…
Reference in New Issue
Block a user