From 08bc747233a2fcc0796c99d88089ebd771bab1ac Mon Sep 17 00:00:00 2001 From: Hendrik Date: Sat, 3 Jan 2026 14:23:54 +0100 Subject: [PATCH] Update src/lib/server/services/notification-service.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/lib/server/services/notification-service.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/server/services/notification-service.ts b/src/lib/server/services/notification-service.ts index dfabf4b..fc76d3e 100644 --- a/src/lib/server/services/notification-service.ts +++ b/src/lib/server/services/notification-service.ts @@ -8,8 +8,18 @@ import { supportedLocales } from "$lib/const/locales"; const notificationCreationSchema = z.object({ channelId: z.uuid({ message: "Invalid UUID format" }), - title: z.partialRecord(z.enum(supportedLocales), z.string().min(1).max(200)), - description: z.partialRecord(z.enum(supportedLocales), z.string().min(1)), + title: z + .partialRecord(z.enum(supportedLocales), z.string().min(1).max(200)) + .refine( + (value) => value != null && Object.keys(value).length > 0, + { message: "At least one localized title is required" }, + ), + description: z + .partialRecord(z.enum(supportedLocales), z.string().min(1)) + .refine( + (value) => value != null && Object.keys(value).length > 0, + { message: "At least one localized description is required" }, + ), }); export type NotificationCreationRequest = z.infer;