feat: améliorer inscription et export apprenants
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 2m21s

This commit is contained in:
manus-admin
2026-10-02 11:11:50 +02:00
parent 2cac56b8c6
commit a7845f5b06
13 changed files with 370 additions and 50 deletions

View File

@@ -12,6 +12,7 @@ import { TRPCError } from "@trpc/server";
import { sendInscriptionConfirmation, sendGroupEmail, sendNotificationFormateurNouvelleInscription, sendNotificationFormateurAnnulation, sendAlerteCapaciteAtteinte, sendNotificationPlaceDisponible, sendRemerciementPostFormation, sendResetPasswordEmail } from "./emailService";
import { logNotification } from "./notificationLogsDb";
import { generateExcelExport, generatePDFExport, generateFeuillePresenceParJour } from "./exportService";
import { generateApprenantsExcelExport } from "./apprenantExportService";
import { parseExcelFile, validateImportData, importToDatabase } from "./importExcel";
import crypto from "crypto";
import bcrypt from "bcryptjs";
@@ -326,6 +327,17 @@ export const appRouter = router({
return { success: true };
}),
exportExcel: adminProcedure.mutation(async () => {
const apprenants = await db.getApprenantsWithFormationNames();
const buffer = generateApprenantsExcelExport(apprenants);
const exportDate = new Date().toISOString().slice(0, 10);
return {
buffer: buffer.toString("base64"),
filename: `apprenants_${exportDate}.xlsx`,
};
}),
getInscriptions: protectedProcedure.input(z.object({ id: z.number() })).query(async ({ input }) => {
const results = await db.getInscriptionsByApprenant(input.id);
// Récupérer les informations de formation et séquence pour chaque inscription