Skip to content

Commit

Permalink
changed contract.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
silvicir committed Nov 7, 2023
1 parent 798bdb2 commit aa755a9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions apps/io-sign-backoffice-func/src/infra/selfcare/contract.ts
Original file line number Diff line number Diff line change
@@ -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"),
})
Expand Down

0 comments on commit aa755a9

Please sign in to comment.