bug fixes
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user