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:
@@ -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