Checkpoint: Ajout de la table deletedInvoices (blacklist) : quand une facture est supprimée, son numéro est enregistré et l'import email/fichier ne la réimporte plus.

This commit is contained in:
Manus
2026-07-30 09:48:00 +00:00
parent aebc607e8a
commit 5d18dfa468
9 changed files with 2323 additions and 7 deletions

View File

@@ -508,3 +508,19 @@ export const freeproSettings = mysqlTable("freeproSettings", {
});
export type FreeproSettings = typeof freeproSettings.$inferSelect;
export type InsertFreeproSettings = typeof freeproSettings.$inferInsert;
/**
* Deleted invoices blacklist — prevents re-import of manually deleted invoices.
* When a user deletes an invoice, its invoiceNumber + totalAmount are stored here.
* The email/file import service checks this table before inserting a new invoice.
*/
export const deletedInvoices = mysqlTable("deletedInvoices", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
invoiceNumber: varchar("invoiceNumber", { length: 100 }).notNull(),
totalAmount: varchar("totalAmount", { length: 50 }),
supplierName: varchar("supplierName", { length: 255 }),
deletedAt: timestamp("deletedAt").defaultNow().notNull(),
});
export type DeletedInvoice = typeof deletedInvoices.$inferSelect;
export type InsertDeletedInvoice = typeof deletedInvoices.$inferInsert;