defined notificationSchema outside of class

This commit is contained in:
Lorinc936 authored and GitHub committed 2026-03-24 18:11:10 +01:00
1 parent e78dc86aa3
commit b2fdab0418
1 file changed
+13 -13
@@ -21,6 +21,19 @@ import type { CalendarEvent } from "../interfaces/calendar/calendar-types";
import type { INotificationsIntegration } from "../interfaces/notifications/notifications-integration";
import type { Notification } from "../interfaces/notifications/notification-types";
const notificationSchema = z.object({
ocs: z.object({
data: z.array(
z.object({
notification_id: z.number(),
datetime: z.string(),
subject: z.string(),
message: z.string(),
}),
),
}),
});
const logger = createLogger({ module: "nextcloudIntegration" });
dayjs.extend(utc);
@@ -121,19 +134,6 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr
if (!response.ok) throw new ResponseError(response);
const notificationSchema = z.object({
ocs: z.object({
data: z.array(
z.object({
notification_id: z.number(),
datetime: z.string(),
subject: z.string(),
message: z.string(),
}),
),
}),
});
const json = notificationSchema.parse(await response.json());
return json.ocs.data.map((notification) => ({