Checkpoint: Ajout de l'association Service→Signature dans l'onglet Signatures des Paramètres et apposition automatique de la signature sur les PDFs exportés lors de l'export BAP. Inclut : table serviceSignatures, routes tRPC, interface de configuration, et modification de exportToPdf pour apposer la signature en bas à droite du PDF avec le nom du signataire.

This commit is contained in:
Manus
2026-03-14 19:28:50 -04:00
parent cf886a1adb
commit ee49992530
8 changed files with 1790 additions and 6 deletions

View File

@@ -0,0 +1,10 @@
CREATE TABLE `serviceSignatures` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`serviceName` varchar(100) NOT NULL,
`signatureId` int NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `serviceSignatures_id` PRIMARY KEY(`id`),
CONSTRAINT `user_service_unique` UNIQUE(`userId`,`serviceName`)
);

File diff suppressed because it is too large Load Diff

View File

@@ -99,6 +99,13 @@
"when": 1773528566252,
"tag": "0013_absent_santa_claus",
"breakpoints": true
},
{
"idx": 14,
"version": "5",
"when": 1773530695041,
"tag": "0014_watery_talos",
"breakpoints": true
}
]
}

View File

@@ -323,3 +323,24 @@ export const signatures = mysqlTable("signatures", {
export type Signature = typeof signatures.$inferSelect;
export type InsertSignature = typeof signatures.$inferInsert;
/**
* Service-Signature association table
* Associates a department/service with a specific signature for PDF exports
*/
export const serviceSignatures = mysqlTable("serviceSignatures", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
serviceName: varchar("serviceName", { length: 100 }).notNull(), // Department name (e.g., "DSI", "TRAVAUX")
signatureId: int("signatureId").notNull(), // FK to signatures.id
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
}, (table) => {
return {
// One association per service per user
userServiceIdx: uniqueIndex("user_service_unique").on(table.userId, table.serviceName),
};
});
export type ServiceSignature = typeof serviceSignatures.$inferSelect;
export type InsertServiceSignature = typeof serviceSignatures.$inferInsert;