updated living space added
This commit is contained in:
@@ -10,25 +10,23 @@ export async function POST(request: Request) {
|
||||
console.log("BODY")
|
||||
console.dir({ body })
|
||||
const validatedBody = userAddSchema.parse(body);
|
||||
validatedBody.person = "6917732face2287b1d901738"
|
||||
try {
|
||||
const client = new GraphQLClient(endpoint);
|
||||
const query = gql`
|
||||
mutation CreateUser($input: CreateUserInput!) {
|
||||
createUser(input: $input) {
|
||||
_id
|
||||
password
|
||||
tag
|
||||
email
|
||||
phone
|
||||
collectionTokens {
|
||||
default
|
||||
tokens {
|
||||
prefix
|
||||
token
|
||||
_id
|
||||
password
|
||||
tag
|
||||
email
|
||||
phone
|
||||
tag
|
||||
collectionTokens {
|
||||
defaultSelection
|
||||
selectedBuildIDS
|
||||
selectedCompanyIDS
|
||||
}
|
||||
}
|
||||
person
|
||||
person
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const tokenSchema = z.object({
|
||||
prefix: z.string().min(1, "Prefix is required"),
|
||||
token: z.string().min(1, "Token is required"),
|
||||
})
|
||||
|
||||
export const collectionTokensSchema = z.object({
|
||||
default: z.string().optional(),
|
||||
tokens: z.array(tokenSchema)
|
||||
})
|
||||
|
||||
export const userAddSchema = z.object({
|
||||
|
||||
expiryStarts: z.string().optional(),
|
||||
expiryEnds: z.string().optional(),
|
||||
|
||||
isConfirmed: z.boolean(),
|
||||
isNotificationSend: z.boolean(),
|
||||
|
||||
password: z.string().min(6),
|
||||
tag: z.string().optional(),
|
||||
email: z.string().email(),
|
||||
phone: z.string().min(5),
|
||||
person: z.string().optional(),
|
||||
person: z.string(),
|
||||
collectionTokens: z.object({
|
||||
defaultSelection: z.string(),
|
||||
selectedBuildIDS: z.array(z.string()),
|
||||
selectedCompanyIDS: z.array(z.string()),
|
||||
}).optional()
|
||||
|
||||
collectionTokens: collectionTokensSchema,
|
||||
})
|
||||
|
||||
export type UserAdd = z.infer<typeof userAddSchema>
|
||||
|
||||
Reference in New Issue
Block a user