mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 09:16:25 +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:
|
||||
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)
|
||||
return redirect(request.referrer)
|
||||
@ -291,8 +297,14 @@ def add_partition(album_uuid):
|
||||
except db.IntegrityError:
|
||||
pass
|
||||
|
||||
flash(f"Partition {request.form['name']} ajoutée")
|
||||
return redirect(f"/albums/{album.uuid}")
|
||||
if "response" in request.args and request.args["response"] == "json":
|
||||
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"])
|
||||
|
@ -89,7 +89,13 @@ def create_groupe():
|
||||
except db.IntegrityError:
|
||||
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)
|
||||
return redirect(request.referrer)
|
||||
|
@ -99,8 +99,14 @@ def add_attachment(uuid):
|
||||
except db.IntegrityError:
|
||||
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>")
|
||||
|
Loading…
Reference in New Issue
Block a user