resolve issues with new features

This commit is contained in:
Matthias Hochmeister
2026-03-12 16:42:21 +01:00
parent 5aa309b97a
commit 68586b01dc
19 changed files with 526 additions and 109 deletions

View File

@@ -13,6 +13,22 @@ class ConfigController {
}
}
async getPdfSettings(_req: Request, res: Response): Promise<void> {
try {
const header = await settingsService.get('pdf_header');
const footer = await settingsService.get('pdf_footer');
res.json({
success: true,
data: {
pdf_header: header?.value ?? '',
pdf_footer: footer?.value ?? '',
},
});
} catch {
res.json({ success: true, data: { pdf_header: '', pdf_footer: '' } });
}
}
async getExternalLinks(_req: Request, res: Response): Promise<void> {
const envLinks: Record<string, string> = {};
if (environment.nextcloudUrl) envLinks.nextcloud = environment.nextcloudUrl;

View File

@@ -67,6 +67,34 @@ class NotificationController {
res.status(500).json({ success: false, message: 'Notifications konnten nicht aktualisiert werden' });
}
}
/** POST /api/notifications/dismiss-by-type — marks all unread notifications of a given type as read. */
async dismissByType(req: Request, res: Response): Promise<void> {
try {
const { quellTyp } = req.body;
if (!quellTyp || typeof quellTyp !== 'string') {
res.status(400).json({ success: false, message: 'quellTyp ist erforderlich' });
return;
}
const userId = req.user!.id;
await notificationService.dismissByType(userId, quellTyp);
res.status(200).json({ success: true, message: 'Notifications als gelesen markiert' });
} catch (error) {
logger.error('NotificationController.dismissByType error', { error });
res.status(500).json({ success: false, message: 'Notifications konnten nicht aktualisiert werden' });
}
}
/** DELETE /api/notifications/read — deletes all read notifications for the authenticated user. */
async deleteAllRead(req: Request, res: Response): Promise<void> {
try {
const userId = req.user!.id;
await notificationService.deleteAllRead(userId);
res.status(200).json({ success: true, message: 'Gelesene Notifications gelöscht' });
} catch (error) {
logger.error('NotificationController.deleteAllRead error', { error });
res.status(500).json({ success: false, message: 'Gelesene Notifications konnten nicht gelöscht werden' });
}
}
}
export default new NotificationController();