From aa755a96eb99f038ff0237427e801dbe7a2a709a Mon Sep 17 00:00:00 2001 From: silvicir <127971996+silvicir@users.noreply.github.com> Date: Tue, 7 Nov 2023 08:28:54 +0100 Subject: [PATCH] changed contract.ts file --- .../src/infra/selfcare/contract.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/io-sign-backoffice-func/src/infra/selfcare/contract.ts b/apps/io-sign-backoffice-func/src/infra/selfcare/contract.ts index 497ab98c..14907bb3 100644 --- a/apps/io-sign-backoffice-func/src/infra/selfcare/contract.ts +++ b/apps/io-sign-backoffice-func/src/infra/selfcare/contract.ts @@ -1,28 +1,26 @@ import { z } from "zod"; -const institution = z.object({ - address: z.string().min(1), - description: z.string().min(1), - digitalAddress: z.string().min(1), - taxCode: z.string().min(1), -}); - -const baseContract = z.object({ +const contract = z.object({ id: z.string().min(1), internalIstitutionID: z.string().min(1), state: z.enum(["ACTIVE", "CLOSED"]), - institution, + institution: z.object({ + address: z.string().min(1), + description: z.string().min(1), + digitalAddress: z.string().min(1), + taxCode: z.string().min(1), + }), billing: z.object({ vatNumber: z.string().min(1), }), product: z.literal("prod-io-sign"), }); -const activeIoSignContract = baseContract.merge( +const activeIoSignContract = contract.merge( z.object({ state: z.literal("ACTIVE") }) ); -const closedIoSignContract = baseContract.merge( +const closedIoSignContract = contract.merge( z.object({ state: z.literal("CLOSED"), })