bug fixes

This commit is contained in:
Matthias Hochmeister
2026-03-03 14:45:46 +01:00
parent 004b141cab
commit 5dfaf7db54
11 changed files with 166 additions and 35 deletions

View File

@@ -18,9 +18,11 @@ function getUserId(req: Request): string {
// ── Controller ────────────────────────────────────────────────────────────────
class AtemschutzController {
async list(_req: Request, res: Response): Promise<void> {
async list(req: Request, res: Response): Promise<void> {
try {
const records = await atemschutzService.getAll();
const userGroups: string[] = (req.user as any)?.groups ?? [];
const userId = getUserId(req);
const records = await atemschutzService.getAll(userGroups, userId);
res.status(200).json({ success: true, data: records });
} catch (error) {
logger.error('Atemschutz list error', { error });
@@ -47,9 +49,11 @@ class AtemschutzController {
}
}
async getStats(_req: Request, res: Response): Promise<void> {
async getStats(req: Request, res: Response): Promise<void> {
try {
const stats = await atemschutzService.getStats();
const userGroups: string[] = (req.user as any)?.groups ?? [];
const userId = getUserId(req);
const stats = await atemschutzService.getStats(userGroups, userId);
res.status(200).json({ success: true, data: stats });
} catch (error) {
logger.error('Atemschutz getStats error', { error });