Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
slug,
)
+ @property
+ def uploads(self):
+ """
+ Returns all uploads that belong to this user
+ """
+ uploads = self.backend.uploads._get_uploads("""
+ SELECT
+ *
+ FROM
+ uploads
+ WHERE
+ user_id = %s
+ AND
+ expires_at > CURRENT_TIMESTAMP
+ ORDER BY
+ created_at DESC
+ """, self.id,
+ )
+
+ return list(uploads)
+
class QuotaExceededError(Exception):
pass
"""
self.buffer.write(data)
+ @tornado.web.authenticated
+ def get(self):
+ uploads = []
+
+ for upload in self.current_user.uploads:
+ uploads.append({
+ "id" : upload.uuid,
+ "filename" : upload.filename,
+ "size" : upload.size,
+
+ "created_at" : upload.created_at.isoformat(),
+ "expires_at" : upload.expires_at.isoformat(),
+ })
+
+ self.finish({
+ "status" : "ok",
+ "uploads" : uploads,
+ })
+
@tornado.web.authenticated
async def put(self):
"""