style: ui improvement to the notification cards.

This commit is contained in:
Nathnael
2026-07-06 10:54:43 +00:00
parent ca3a6072d8
commit 298ad6227b
11 changed files with 211 additions and 109 deletions

View File

@@ -1,5 +1,9 @@
import { CurrentUser } from "@edr/api-common";
import { NotificationAudience } from "@edr/types";
import {
NotificationAudience,
NotificationPriority,
NotificationType,
} from "@edr/types";
import {
Body,
Controller,
@@ -62,7 +66,13 @@ export class NotificationInboxController {
sendTest(
@CurrentUser() user: AuthUserPayload,
@Body()
body: { audience?: NotificationAudience; title?: string; message?: string },
body: {
audience?: NotificationAudience;
type?: NotificationType;
priority?: NotificationPriority;
title?: string;
message?: string;
},
) {
return this.service.sendTestToUser(resolveAuthUserId(user), body ?? {});
}

View File

@@ -109,15 +109,21 @@ export class NotificationInboxService {
/** [dev/verification only] Send a canned notification straight to one user. */
async sendTestToUser(
userId: string,
body: { audience?: NotificationAudience; title?: string; message?: string },
body: {
audience?: NotificationAudience;
type?: NotificationType;
priority?: NotificationPriority;
title?: string;
message?: string;
},
): Promise<NotificationDto> {
const entity = await this.repo.create({
recipientUserId: userId,
audience: body.audience ?? NotificationAudience.BACKOFFICE,
type: NotificationType.GENERIC,
type: body.type ?? NotificationType.GENERIC,
title: body.title ?? "Test notification",
body: body.message ?? "This is a test in-app notification.",
priority: NotificationPriority.NORMAL,
priority: body.priority ?? NotificationPriority.NORMAL,
isRead: false,
});
const dto = this.toDto(entity);