From e3a3a91ef5680a25041418184c1a537a8aa4fff4 Mon Sep 17 00:00:00 2001 From: hafemann Date: Wed, 2 Oct 2024 15:03:47 +0200 Subject: [PATCH] :bug: fix missing relates to in contact validation --- src/schemas/calendar-events.ts | 31 ------------------------------- src/schemas/contacts.ts | 9 +++++++++ src/schemas/index.ts | 1 - src/schemas/schema.model.ts | 9 --------- 4 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 src/schemas/calendar-events.ts delete mode 100644 src/schemas/schema.model.ts diff --git a/src/schemas/calendar-events.ts b/src/schemas/calendar-events.ts deleted file mode 100644 index 7dc29d0e..00000000 --- a/src/schemas/calendar-events.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ValidationSchema } from './schema.model'; - -export const calendarEventsSchema: ValidationSchema = { - title: 'CalendarEvents', - type: 'array', - items: { - type: 'object', - properties: { - fillDefaults: true, - id: { - type: 'string', - }, - title: { - type: ['string', 'null'], - }, - description: { - type: ['string', 'null'], - }, - eventUrl: { - type: ['string', 'null'], - }, - start: { - type: ['number', 'null'], - }, - end: { - type: ['number', 'null'], - }, - }, - required: ['id', 'title', 'description', 'eventUrl', 'start', 'end'], - }, -}; diff --git a/src/schemas/contacts.ts b/src/schemas/contacts.ts index fe54341f..66d0fdab 100644 --- a/src/schemas/contacts.ts +++ b/src/schemas/contacts.ts @@ -66,6 +66,14 @@ import { IntegrationEntityType } from '../models/integration-entity.model'; // }, // }; +const integrationEntitySchema = z.object({ + id: z.string(), + type: z.nativeEnum(IntegrationEntityType), + source: z.string(), + label: z.string().optional(), + logId: z.string().optional(), +}); + export const contactSchema = z.object({ id: z.string(), name: z.string().nullable(), @@ -83,6 +91,7 @@ export const contactSchema = z.object({ }), ), type: z.nativeEnum(IntegrationEntityType).optional(), + relatesTo: z.array(integrationEntitySchema).optional(), }); export const contactsGetSchema = z.array(contactSchema); diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 288126a0..8ebf7ad6 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,2 +1 @@ -export * from './calendar-events'; export * from './contacts'; diff --git a/src/schemas/schema.model.ts b/src/schemas/schema.model.ts deleted file mode 100644 index 45a8fabd..00000000 --- a/src/schemas/schema.model.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type ValidationSchema = { - title: string; - type: string; - items: { - type: string; - properties: unknown; - required: string[]; - }; -};