Checkpoint: Ajout de l'onglet "Paramétrage" dans la page Ventilation FreePro :
- Table DB freeproSettings (URL portail, credentials, fréquence, date antériorité, statut dernière récupération) - Service freeproAutoImport.ts : connexion HTTP au portail FreePro, téléchargement CSV, pipeline d'import - Procédures tRPC : getSettings, saveSettings, testConnection, forceImport - Job périodique en mémoire (daily/weekly/monthly) via setInterval - Frontend : wrapper Tabs (onglet 1 = Import & Historique, onglet 2 = Paramétrage) - Onglet Paramétrage : credentials, fréquence, date antériorité, bouton "Forcer récupération", statut - Tests unitaires : 8 tests passés
This commit is contained in:
17
drizzle/0029_unknown_spot.sql
Normal file
17
drizzle/0029_unknown_spot.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE `freeproSettings` (
|
||||
`id` int AUTO_INCREMENT NOT NULL,
|
||||
`userId` int NOT NULL,
|
||||
`portalUrl` varchar(255) NOT NULL DEFAULT 'https://pro.free.fr',
|
||||
`loginEmail` varchar(320),
|
||||
`loginPassword` text,
|
||||
`frequency` enum('manual','daily','weekly','monthly') NOT NULL DEFAULT 'manual',
|
||||
`maxAnteriority` int,
|
||||
`autoEnabled` int NOT NULL DEFAULT 0,
|
||||
`lastSuccessAt` timestamp,
|
||||
`lastStatus` text,
|
||||
`lastImportCount` int DEFAULT 0,
|
||||
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
||||
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT `freeproSettings_id` PRIMARY KEY(`id`),
|
||||
CONSTRAINT `freeproSettings_userId_unique` UNIQUE(`userId`)
|
||||
);
|
||||
2112
drizzle/meta/0029_snapshot.json
Normal file
2112
drizzle/meta/0029_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -204,6 +204,13 @@
|
||||
"when": 1780660548610,
|
||||
"tag": "0028_dusty_kat_farrell",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 29,
|
||||
"version": "5",
|
||||
"when": 1780924653802,
|
||||
"tag": "0029_unknown_spot",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -464,3 +464,34 @@ export const freeproVentilationLines = mysqlTable("freeproVentilationLines", {
|
||||
});
|
||||
export type FreeproVentilationLine = typeof freeproVentilationLines.$inferSelect;
|
||||
export type InsertFreeproVentilationLine = typeof freeproVentilationLines.$inferInsert;
|
||||
|
||||
/**
|
||||
* FreePro settings — paramètres de connexion automatique au portail FreePro
|
||||
* et de récupération périodique des factures CSV
|
||||
*/
|
||||
export const freeproSettings = mysqlTable("freeproSettings", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
userId: int("userId").notNull().unique(), // Un paramétrage par utilisateur
|
||||
/** URL du portail FreePro (ex: https://pro.free.fr) */
|
||||
portalUrl: varchar("portalUrl", { length: 255 }).default("https://pro.free.fr").notNull(),
|
||||
/** Email de connexion au portail FreePro */
|
||||
loginEmail: varchar("loginEmail", { length: 320 }),
|
||||
/** Mot de passe de connexion au portail FreePro */
|
||||
loginPassword: text("loginPassword"),
|
||||
/** Fréquence de récupération automatique */
|
||||
frequency: mysqlEnum("frequency", ["manual", "daily", "weekly", "monthly"]).default("manual").notNull(),
|
||||
/** Date d'antériorité max (timestamp Unix ms) — ne pas récupérer les factures antérieures à cette date */
|
||||
maxAnteriority: int("maxAnteriority"), // Timestamp Unix en secondes
|
||||
/** Activation de la récupération automatique */
|
||||
autoEnabled: int("autoEnabled").default(0).notNull(), // 0 = désactivé, 1 = activé
|
||||
/** Date de la dernière récupération réussie */
|
||||
lastSuccessAt: timestamp("lastSuccessAt"),
|
||||
/** Message de statut de la dernière récupération */
|
||||
lastStatus: text("lastStatus"),
|
||||
/** Nombre de factures récupérées lors du dernier run */
|
||||
lastImportCount: int("lastImportCount").default(0),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
|
||||
});
|
||||
export type FreeproSettings = typeof freeproSettings.$inferSelect;
|
||||
export type InsertFreeproSettings = typeof freeproSettings.$inferInsert;
|
||||
|
||||
Reference in New Issue
Block a user