diff --git a/api/src/main.py b/api/src/main.py index 4d88349..3f142d9 100644 --- a/api/src/main.py +++ b/api/src/main.py @@ -190,3 +190,12 @@ async def save_uploaded_files_endpoint(files: list[UploadFile], sessionId: str = """ result = await UploadedFiles(session_id=sessionId)._save_sources(files) return result + + +@app.delete("/delete-session/{sessionId}") +def delete_session_endpoint(sessionId: str): + """ + Delete audiocast session + """ + SessionManager._delete_session(sessionId) + return "Deleted" diff --git a/api/src/utils/session_manager.py b/api/src/utils/session_manager.py index 37f57e5..704779e 100644 --- a/api/src/utils/session_manager.py +++ b/api/src/utils/session_manager.py @@ -146,3 +146,7 @@ def on_snapshot(doc_snapshot, _changes, _read_time): callback(info) return doc_ref.on_snapshot(on_snapshot) + + @staticmethod + def _delete_session(doc_id: str): + return DBManager()._delete_document(collections["audiora_sessions"], doc_id) diff --git a/app/src/lib/components/Sidebar.svelte b/app/src/lib/components/Sidebar.svelte index 3da27fd..a9c93a7 100644 --- a/app/src/lib/components/Sidebar.svelte +++ b/app/src/lib/components/Sidebar.svelte @@ -40,7 +40,7 @@ import NewAudiocastButton from './NewAudiocastButton.svelte'; import { goto } from '$app/navigation'; import { browser } from '$app/environment'; - // import { env } from '@env'; + import { env } from '@env'; const dispatch = createEventDispatcher<{ clickItem: void }>(); const { openSettingsDrawer$ } = getAppContext(); @@ -66,9 +66,9 @@ localStorage.removeItem(`${SESSION_KEY}_${sessionId}`); sidebarItems = getSidebarItems(getSessionItems()); - // void fetch(`${env.API_BASE_URL}/delete-session/${sessionId}`, { - // method: 'DELETE' - // }).catch(() => {}); + void fetch(`${env.API_BASE_URL}/delete-session/${sessionId}`, { + method: 'DELETE' + }).catch(() => void 0); return goto('/', { invalidateAll: true, replaceState: true }); }; @@ -104,7 +104,7 @@ {/if}
-
Today
+
Today
{#each inLast24Hrs as item (item.sessionId)}
-
Last 7 days
+
Last 7 days
{#each inLast7Days as item (item.sessionId)}
-
Last month
+
Last month
{#each inLast30Days as item (item.sessionId)}