diff --git a/src/StudentsController.ts b/src/StudentsController.ts index f9b06da..90a107f 100644 --- a/src/StudentsController.ts +++ b/src/StudentsController.ts @@ -46,7 +46,7 @@ export class StudentsController { givenname: string; surname: string; pin?: string; - additionalConsents: { mustBeAccepted?: boolean; consent: string; link: string; linkDisplayText?: string }[]; + additionalConsents: { mustBeAccepted?: boolean; consent: string; link?: string; linkDisplayText?: string }[]; }): Promise { const identityInfo = await this.services.transportServices.account.getIdentityInfo(); @@ -110,7 +110,7 @@ export class StudentsController { mustBeAccepted: consent.mustBeAccepted ?? false, consent: consent.consent, link: consent.link, - linkDisplayText: consent.linkDisplayText + linkDisplayText: consent.link !== undefined ? consent.linkDisplayText : undefined })) }); } diff --git a/src/controllers/schemas.ts b/src/controllers/schemas.ts index 57f30f0..0e2ce72 100644 --- a/src/controllers/schemas.ts +++ b/src/controllers/schemas.ts @@ -12,8 +12,8 @@ export const createStudentRequestSchema = z.object({ .array( z.object({ mustBeAccepted: z.boolean().optional(), - consent: z.string().min(1).max(64), - link: z.string().url(), + consent: z.string().min(1).max(2000), + link: z.string().url().optional(), linkDisplayText: z.string().min(1).max(64).optional() }) )