Checkpoint: Ajout du bouton "Effacer les logs" dans la page Historique d'import avec confirmation de suppression.
This commit is contained in:
@@ -413,6 +413,12 @@ export async function getImportLogsByUser(userId: number): Promise<ImportLog[]>
|
||||
return db.select().from(importLogs).where(eq(importLogs.userId, userId)).orderBy(desc(importLogs.importedAt));
|
||||
}
|
||||
|
||||
export async function deleteAllImportLogs(userId: number): Promise<void> {
|
||||
const db = await getDb();
|
||||
if (!db) throw new Error("Database not available");
|
||||
await db.delete(importLogs).where(eq(importLogs.userId, userId));
|
||||
}
|
||||
|
||||
// ============= LLM LOG OPERATIONS =============
|
||||
|
||||
export async function createLlmLog(data: InsertLlmLog): Promise<LlmLog> {
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
findDuplicateInvoice,
|
||||
createImportLog,
|
||||
getImportLogsByUser,
|
||||
deleteAllImportLogs,
|
||||
getLlmLogsBySourceFile,
|
||||
getLlmLogsByInvoice,
|
||||
getImportSettingsByUser,
|
||||
@@ -560,6 +561,11 @@ export const appRouter = router({
|
||||
getByUser: protectedProcedure.query(async ({ ctx }) => {
|
||||
return getImportLogsByUser(ctx.user.id);
|
||||
}),
|
||||
|
||||
deleteAll: protectedProcedure.mutation(async ({ ctx }) => {
|
||||
await deleteAllImportLogs(ctx.user.id);
|
||||
return { success: true };
|
||||
}),
|
||||
}),
|
||||
|
||||
// ============= LLM LOGS ROUTES =============
|
||||
|
||||
Reference in New Issue
Block a user