Checkpoint: Ajout de 3 champs métier aux factures (Service concerné, Type d'achat, Ventilation comptable) avec interface d'administration pour gérer les listes enrichissables. Les champs apparaissent dans la liste des factures et dans le formulaire d'édition.
This commit is contained in:
21
drizzle/0004_white_the_hunter.sql
Normal file
21
drizzle/0004_white_the_hunter.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE `accountingAllocationList` (
|
||||
`id` int AUTO_INCREMENT NOT NULL,
|
||||
`userId` int NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
||||
CONSTRAINT `accountingAllocationList_id` PRIMARY KEY(`id`),
|
||||
CONSTRAINT `user_allocation_unique` UNIQUE(`userId`,`name`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `departmentList` (
|
||||
`id` int AUTO_INCREMENT NOT NULL,
|
||||
`userId` int NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
||||
CONSTRAINT `departmentList_id` PRIMARY KEY(`id`),
|
||||
CONSTRAINT `user_department_unique` UNIQUE(`userId`,`name`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE `invoices` ADD `serviceConcerne` varchar(100);--> statement-breakpoint
|
||||
ALTER TABLE `invoices` ADD `typeAchat` enum('CAPEX','OPEX');--> statement-breakpoint
|
||||
ALTER TABLE `invoices` ADD `ventilationComptable` varchar(100);
|
||||
1081
drizzle/meta/0004_snapshot.json
Normal file
1081
drizzle/meta/0004_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,13 @@
|
||||
"when": 1770742897031,
|
||||
"tag": "0003_previous_killraven",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "5",
|
||||
"when": 1770814574366,
|
||||
"tag": "0004_white_the_hunter",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -84,6 +84,11 @@ export const invoices = mysqlTable("invoices", {
|
||||
// Manual correction tracking
|
||||
manuallyEdited: int("manuallyEdited").default(0).notNull(), // 0 = false, 1 = true
|
||||
|
||||
// Business fields (optional)
|
||||
serviceConcerne: varchar("serviceConcerne", { length: 100 }), // Service concerné (DSI, TRAVAUX, etc.)
|
||||
typeAchat: mysqlEnum("typeAchat", ["CAPEX", "OPEX"]), // Type d'achat
|
||||
ventilationComptable: varchar("ventilationComptable", { length: 100 }), // Ventilation comptable (TOUS, PA, HEP, etc.)
|
||||
|
||||
// SFTP Export tracking
|
||||
exportedAt: timestamp("exportedAt"),
|
||||
exportMode: mysqlEnum("exportMode", ["manual", "automatic"]),
|
||||
@@ -202,3 +207,39 @@ export const llmLogs = mysqlTable("llmLogs", {
|
||||
|
||||
export type LlmLog = typeof llmLogs.$inferSelect;
|
||||
export type InsertLlmLog = typeof llmLogs.$inferInsert;
|
||||
|
||||
/**
|
||||
* Department list table for managing "Service concerné" values
|
||||
*/
|
||||
export const departmentList = mysqlTable("departmentList", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
userId: int("userId").notNull(), // Each user has their own list
|
||||
name: varchar("name", { length: 100 }).notNull(),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
}, (table) => {
|
||||
return {
|
||||
// Unique constraint: no duplicate department names for the same user
|
||||
userDepartmentIdx: uniqueIndex("user_department_unique").on(table.userId, table.name),
|
||||
};
|
||||
});
|
||||
|
||||
export type Department = typeof departmentList.$inferSelect;
|
||||
export type InsertDepartment = typeof departmentList.$inferInsert;
|
||||
|
||||
/**
|
||||
* Accounting allocation list table for managing "Ventilation comptable" values
|
||||
*/
|
||||
export const accountingAllocationList = mysqlTable("accountingAllocationList", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
userId: int("userId").notNull(), // Each user has their own list
|
||||
name: varchar("name", { length: 100 }).notNull(),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
}, (table) => {
|
||||
return {
|
||||
// Unique constraint: no duplicate allocation names for the same user
|
||||
userAllocationIdx: uniqueIndex("user_allocation_unique").on(table.userId, table.name),
|
||||
};
|
||||
});
|
||||
|
||||
export type AccountingAllocation = typeof accountingAllocationList.$inferSelect;
|
||||
export type InsertAccountingAllocation = typeof accountingAllocationList.$inferInsert;
|
||||
|
||||
Reference in New Issue
Block a user