mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-02-03 10:48:00 +01:00
Compare commits
No commits in common. "2de234870e1913827f7559df6c32c20b3d67610a" and "3b08f2e08c1b3e616d3a80485f22e2c0a0c9f24e" have entirely different histories.
2de234870e
...
3b08f2e08c
@ -131,13 +131,7 @@ def create_album():
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if "response" in request.args and request.args["response"] == "json":
|
return redirect(f"/albums/{uuid}")
|
||||||
return {
|
|
||||||
"status": "ok",
|
|
||||||
"uuid": uuid
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
return redirect(f"/albums/{uuid}")
|
|
||||||
|
|
||||||
flash(error)
|
flash(error)
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
@ -297,14 +291,8 @@ def add_partition(album_uuid):
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if "response" in request.args and request.args["response"] == "json":
|
flash(f"Partition {request.form['name']} ajoutée")
|
||||||
return {
|
return redirect(f"/albums/{album.uuid}")
|
||||||
"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"])
|
||||||
|
@ -2,7 +2,7 @@ import os
|
|||||||
|
|
||||||
from ..db import get_db
|
from ..db import get_db
|
||||||
|
|
||||||
from .attachment import Attachment
|
|
||||||
|
|
||||||
class Album():
|
class Album():
|
||||||
def __init__(self, uuid=None, id=None):
|
def __init__(self, uuid=None, id=None):
|
||||||
@ -116,18 +116,6 @@ class Album():
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
for partition in partitions.fetchall():
|
for partition in partitions.fetchall():
|
||||||
data = db.execute(
|
|
||||||
"""
|
|
||||||
SELECT * FROM attachments
|
|
||||||
WHERE partition_uuid = ?
|
|
||||||
""",
|
|
||||||
(partition["uuid"],)
|
|
||||||
)
|
|
||||||
attachments = [Attachment(data=i) for i in data]
|
|
||||||
|
|
||||||
for attachment in attachments:
|
|
||||||
attachment.delete()
|
|
||||||
|
|
||||||
os.remove(f"partitioncloud/partitions/{partition['uuid']}.pdf")
|
os.remove(f"partitioncloud/partitions/{partition['uuid']}.pdf")
|
||||||
if os.path.exists(f"partitioncloud/static/thumbnails/{partition['uuid']}.jpg"):
|
if os.path.exists(f"partitioncloud/static/thumbnails/{partition['uuid']}.jpg"):
|
||||||
os.remove(f"partitioncloud/static/thumbnails/{partition['uuid']}.jpg")
|
os.remove(f"partitioncloud/static/thumbnails/{partition['uuid']}.jpg")
|
||||||
|
@ -54,9 +54,9 @@ class Groupe():
|
|||||||
"""
|
"""
|
||||||
SELECT id FROM album
|
SELECT id FROM album
|
||||||
LEFT JOIN groupe_contient_album
|
LEFT JOIN groupe_contient_album
|
||||||
ON groupe_contient_album.album_id=album.id
|
|
||||||
LEFT JOIN contient_user
|
LEFT JOIN contient_user
|
||||||
ON contient_user.album_id=album.id
|
ON groupe_contient_album.album_id=album.id
|
||||||
|
AND contient_user.album_id=album.id
|
||||||
WHERE user_id IS NULL AND groupe_id IS NULL
|
WHERE user_id IS NULL AND groupe_id IS NULL
|
||||||
"""
|
"""
|
||||||
).fetchall()
|
).fetchall()
|
||||||
|
@ -194,16 +194,15 @@ class User():
|
|||||||
|
|
||||||
def quit_album(self, album_uuid):
|
def quit_album(self, album_uuid):
|
||||||
db = get_db()
|
db = get_db()
|
||||||
|
album = Album(uuid=album_uuid)
|
||||||
|
|
||||||
db.execute(
|
db.execute(
|
||||||
"""
|
"""
|
||||||
DELETE FROM contient_user
|
DELETE FROM contient_user
|
||||||
JOIN album
|
|
||||||
ON album.id = album_id
|
|
||||||
WHERE user_id = ?
|
WHERE user_id = ?
|
||||||
AND album.uuid = ?
|
AND album_id = ?
|
||||||
""",
|
""",
|
||||||
(self.id, album_uuid)
|
(self.id, album.id)
|
||||||
)
|
)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
@ -89,13 +89,7 @@ def create_groupe():
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if "response" in request.args and request.args["response"] == "json":
|
return redirect(f"/groupe/{uuid}")
|
||||||
return {
|
|
||||||
"status": "ok",
|
|
||||||
"uuid": uuid
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
return redirect(f"/groupe/{uuid}")
|
|
||||||
|
|
||||||
flash(error)
|
flash(error)
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
@ -207,13 +201,7 @@ def create_album(groupe_uuid):
|
|||||||
except db.IntegrityError:
|
except db.IntegrityError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if "response" in request.args and request.args["response"] == "json":
|
return redirect(f"/groupe/{groupe.uuid}/{uuid}")
|
||||||
return {
|
|
||||||
"status": "ok",
|
|
||||||
"uuid": uuid
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
return redirect(f"/groupe/{groupe.uuid}/{uuid}")
|
|
||||||
|
|
||||||
flash(error)
|
flash(error)
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
|
@ -100,13 +100,7 @@ def add_attachment(uuid):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if "response" in request.args and request.args["response"] == "json":
|
return redirect(f"/partition/{partition.uuid}/attachments")
|
||||||
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…
x
Reference in New Issue
Block a user