Checkpoint: Améliorations Factures BAP : suppression colonne Abonnement, mode d'export configurable (navigateur/dossier), génération PDF annoté avec zone blanche (CAPEX/OPEX | BAP | Destinataire + signature du service) lors du clic BAP, historique BAP dans le menu Traçabilité, table bapHistory en DB.

This commit is contained in:
Manus
2026-04-12 05:57:02 -04:00
parent edf7cc704d
commit 5f7c8c7c7f
12 changed files with 2261 additions and 39 deletions

View File

@@ -0,0 +1,21 @@
CREATE TABLE `bapHistory` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`invoiceId` int NOT NULL,
`supplierName` varchar(255),
`invoiceNumber` varchar(100),
`invoiceDate` timestamp,
`totalAmount` varchar(50),
`typeAchat` varchar(50),
`serviceConcerne` varchar(100),
`ventilationComptable` varchar(100),
`recipientName` varchar(255),
`exportMode` enum('browser','folder') NOT NULL DEFAULT 'browser',
`exportPath` text,
`pdfUrl` text,
`signatureName` varchar(255),
`validatedAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `bapHistory_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
ALTER TABLE `importSettings` ADD `bapExportMode` enum('browser','folder') DEFAULT 'browser' NOT NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -120,6 +120,13 @@
"when": 1775985531192,
"tag": "0016_tricky_quasimodo",
"breakpoints": true
},
{
"idx": 17,
"version": "5",
"when": 1775987314108,
"tag": "0017_clammy_toad",
"breakpoints": true
}
]
}

View File

@@ -178,6 +178,7 @@ export const importSettings = mysqlTable("importSettings", {
// Export folder settings
exportFolder: text("exportFolder"), // Path to folder for exporting invoices
bapExportMode: mysqlEnum("bapExportMode", ["browser", "folder"]).default("browser").notNull(), // BAP export mode: open in browser or save to folder
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
@@ -347,3 +348,27 @@ export const serviceSignatures = mysqlTable("serviceSignatures", {
export type ServiceSignature = typeof serviceSignatures.$inferSelect;
export type InsertServiceSignature = typeof serviceSignatures.$inferInsert;
/**
* BAP History table - records every BAP validation with PDF export details
*/
export const bapHistory = mysqlTable("bapHistory", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
invoiceId: int("invoiceId").notNull(),
supplierName: varchar("supplierName", { length: 255 }),
invoiceNumber: varchar("invoiceNumber", { length: 100 }),
invoiceDate: timestamp("invoiceDate"),
totalAmount: varchar("totalAmount", { length: 50 }),
typeAchat: varchar("typeAchat", { length: 50 }), // CAPEX / OPEX
serviceConcerne: varchar("serviceConcerne", { length: 100 }),
ventilationComptable: varchar("ventilationComptable", { length: 100 }),
recipientName: varchar("recipientName", { length: 255 }),
exportMode: mysqlEnum("exportMode", ["browser", "folder"]).default("browser").notNull(),
exportPath: text("exportPath"), // null for browser mode
pdfUrl: text("pdfUrl"), // S3 URL for browser mode
signatureName: varchar("signatureName", { length: 255 }), // Signer name if applied
validatedAt: timestamp("validatedAt").defaultNow().notNull(),
});
export type BapHistory = typeof bapHistory.$inferSelect;
export type InsertBapHistory = typeof bapHistory.$inferInsert;