Commit
Add session delete to the store
commit
4d323bc
1 changed file with +8 and −1
modified server/store/sessionStore.ts +8 −1
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | import { randomUUID } from 'node:crypto' |
| 2 | -import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises' | |
| 2 | +import { mkdir, readdir, readFile, rename, rm, writeFile } from 'node:fs/promises' | |
| 3 | 3 | import path from 'node:path' |
| 4 | 4 | import { |
| 5 | 5 | SessionSchema, |
| @@ -82,6 +82,13 @@export class SessionStore { | ||
| 82 | 82 | return summaries |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + async deleteSession(id: string): Promise<boolean> { | |
| 86 | + const session = await this.getSession(id) | |
| 87 | + if (!session) return false | |
| 88 | + await rm(this.sessionDir(id), { recursive: true, force: true }) | |
| 89 | + return true | |
| 90 | + } | |
| 91 | + | |
| 85 | 92 | async appendSegment( |
| 86 | 93 | id: string, |
| 87 | 94 | speaker: Speaker, |