Checkpoint: Ajout d'une interface d'administration complète pour personnaliser les templates d'emails avec prévisualisation en temps réel, stockage en base de données et intégration avec le service d'envoi
This commit is contained in:
@@ -625,6 +625,47 @@ export const appRouter = router({
|
||||
return { success: true, message: "Email de réinitialisation envoyé" };
|
||||
}),
|
||||
}),
|
||||
|
||||
// ===== GESTION DES TEMPLATES D'EMAILS =====
|
||||
emailTemplates: router({
|
||||
list: adminProcedure.query(async () => {
|
||||
return db.getAllEmailTemplates();
|
||||
}),
|
||||
|
||||
getByType: adminProcedure
|
||||
.input(z.object({ type: z.string() }))
|
||||
.query(async ({ input }) => {
|
||||
return db.getEmailTemplateByType(input.type);
|
||||
}),
|
||||
|
||||
upsert: adminProcedure
|
||||
.input(z.object({
|
||||
type: z.string(),
|
||||
name: z.string(),
|
||||
logoUrl: z.string().nullable(),
|
||||
primaryColor: z.string(),
|
||||
headerBgColor: z.string(),
|
||||
headerTextColor: z.string(),
|
||||
headerTitle: z.string(),
|
||||
footerText: z.string().nullable(),
|
||||
active: z.boolean(),
|
||||
}))
|
||||
.mutation(async ({ input }) => {
|
||||
return db.upsertEmailTemplate(input);
|
||||
}),
|
||||
|
||||
delete: adminProcedure
|
||||
.input(z.object({ type: z.string() }))
|
||||
.mutation(async ({ input }) => {
|
||||
await db.deleteEmailTemplate(input.type);
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
initializeDefaults: adminProcedure.mutation(async () => {
|
||||
await db.initializeDefaultEmailTemplates();
|
||||
return { success: true };
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
|
||||
Reference in New Issue
Block a user