feat: améliorer inscription et export apprenants
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 2m21s
Some checks failed
Validation applicative / TypeScript, tests et build (push) Failing after 2m21s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user