feat(auth): add profile and QR card identification endpoints

This commit is contained in:
SaidSoighiri94
2026-06-22 10:13:45 +02:00
parent 20490a05c5
commit b5a7577e8d
7 changed files with 106 additions and 5 deletions
@@ -0,0 +1,23 @@
import { Request, Response } from 'express';
import { AppError } from '../errors/app-error';
import { getProfil, identifierParCarte } from '../services/utilisateur.service';
export async function getMe(req: Request, res: Response): Promise<void> {
const user = req.user;
if (!user) {
throw new AppError(401, 'Authentification requise');
}
const profil = await getProfil(user.id);
res.json({ data: profil });
}
export async function identifier(req: Request, res: Response): Promise<void> {
const qr = req.params.qr;
if (typeof qr !== 'string') {
throw new AppError(400, 'QR code invalide');
}
const profil = await identifierParCarte(qr);
res.json({ data: profil });
}