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:
10
drizzle/0014_watery_talos.sql
Normal file
10
drizzle/0014_watery_talos.sql
Normal 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`)
|
||||
);
|
||||
1450
drizzle/meta/0014_snapshot.json
Normal file
1450
drizzle/meta/0014_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user