ConusAI vendor 81941888f

This commit is contained in:
ConusAI vendor 81941888f
2026-10-07 08:47:51 +00:00
commit c3c6526952
135 changed files with 13010 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
'use server'
import { revalidatePath } from 'next/cache'
import { fileRepository } from '@/entities/file'
import { noteId } from '@/entities/note'
import { audit, blob, db } from '@/shared/api'
import { ensureVisitor } from '@/shared/lib/visitor-session'
/** Remove an attachment the visitor attached: its row first, then its stored bytes. */
export async function deleteFile(id: string): Promise<void> {
const key = noteId.parse(id)
const actor = await ensureVisitor()
const removed = await fileRepository(db()).remove(key, actor)
if (!removed) return
await blob().del(removed.url)
await audit().log('file.deleted', { actor: { kind: 'human', id: actor }, target: { id: key } })
revalidatePath('/')
}