Checkpoint: Ajout de la page de gestion des attestations de formation
Fonctionnalités : - Configuration par formation (génération auto/manuel, envoi auto/manuel) - Affichage de la liste des apprenants inscrits - Upload de documents PDF par apprenant (mode manuel) - Boutons de prévisualisation et d'envoi manuel - Gestion complète des attestations Corrections : - Ajout des colonnes modeAttestation et modeEnvoi dans la table formations - Ajout des colonnes documentUrl, documentS3Key, uploadedBy, uploadedAt, emailEnvoye, dateEnvoiEmail dans la table attestations - Correction de l'erreur SQL en retirant la colonne urlPdf inexistante de la requête
This commit is contained in:
@@ -145,10 +145,26 @@ export async function getApprenantsWithAttestationStatus(formationId: number) {
|
||||
|
||||
const results = await db
|
||||
.select({
|
||||
apprenant: apprenants,
|
||||
inscription: inscriptions,
|
||||
sequence: sequences,
|
||||
attestation: attestations,
|
||||
apprenant: {
|
||||
id: apprenants.id,
|
||||
nom: apprenants.nom,
|
||||
prenom: apprenants.prenom,
|
||||
email: apprenants.email,
|
||||
},
|
||||
inscription: {
|
||||
id: inscriptions.id,
|
||||
sequenceId: inscriptions.sequenceId,
|
||||
},
|
||||
sequence: {
|
||||
id: sequences.id,
|
||||
nom: sequences.nom,
|
||||
},
|
||||
attestation: {
|
||||
id: attestations.id,
|
||||
documentUrl: attestations.documentUrl,
|
||||
emailEnvoye: attestations.emailEnvoye,
|
||||
dateEnvoiEmail: attestations.dateEnvoiEmail,
|
||||
},
|
||||
})
|
||||
.from(inscriptions)
|
||||
.innerJoin(apprenants, eq(inscriptions.apprenantId, apprenants.id))
|
||||
|
||||
@@ -2312,8 +2312,15 @@ export const appRouter = router({
|
||||
getApprenantsWithStatus: adminProcedure
|
||||
.input(z.object({ formationId: z.number() }))
|
||||
.query(async ({ input }) => {
|
||||
const { getApprenantsWithAttestationStatus } = await import("./gestionAttestationsDb");
|
||||
return getApprenantsWithAttestationStatus(input.formationId);
|
||||
try {
|
||||
const { getApprenantsWithAttestationStatus } = await import("./gestionAttestationsDb");
|
||||
const results = await getApprenantsWithAttestationStatus(input.formationId);
|
||||
console.log("[gestionAttestations] Found", results.length, "apprenants for formation", input.formationId);
|
||||
return results;
|
||||
} catch (error) {
|
||||
console.error("[gestionAttestations] Error fetching apprenants:", error);
|
||||
throw error;
|
||||
}
|
||||
}),
|
||||
|
||||
// Uploader un document d'attestation
|
||||
|
||||
Reference in New Issue
Block a user