diff --git a/app.py b/app.py index b8657ec..0485bd7 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ import threading from concurrent.futures import ThreadPoolExecutor from datetime import datetime from pathlib import Path -from typing import Optional +from typing import List, Optional import markdown as md import requests @@ -578,6 +578,7 @@ def library(project_id: Optional[str] = None, q_title: str = "", q_content: str rows = "".join( [ f"" + f"" f"#{d['id']}" f"{d['title']}" f"{d['kind']}" @@ -619,20 +620,75 @@ def library(project_id: Optional[str] = None, q_title: str = "", q_content: str
Reset
+
- - {rows or ""} + + + + + {rows or ""}
IDTitelTypProjektErstelltAktionen
Keine Einträge.
IDTitelTypProjektErstelltAktionen
Keine Einträge.
+
+ + +
""" return layout("Library", body) @@ -755,6 +826,20 @@ def delete_document(doc_id: int): return HTMLResponse("") +@app.post("/documents/bulk-move", response_class=HTMLResponse) +def bulk_move_documents(ids: List[int] = Form(...), project_id: int = Form(...)): + with db() as c: + c.executemany("UPDATE documents SET project_id=? WHERE id=?", [(project_id, i) for i in ids]) + return HTMLResponse("") + + +@app.post("/documents/bulk-delete", response_class=HTMLResponse) +def bulk_delete_documents(ids: List[int] = Form(...)): + with db() as c: + c.executemany("DELETE FROM documents WHERE id=?", [(i,) for i in ids]) + return HTMLResponse("") + + @app.get("/prompts", response_class=HTMLResponse) def prompts_page(): with db() as c: