-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.interface.ts
53 lines (48 loc) · 1.16 KB
/
response.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import z from "zod";
export const userSchema = z.object({
address: z.object({
geolocation: z.object({
lat: z.string(),
long: z.string()
}),
city: z.string(),
street: z.string(),
number: z.number(),
zipcode: z.string(),
}),
id: z.number(),
email: z.string(),
username: z.string(),
password: z.string(),
name: z.object({
firstname: z.string(),
lastname: z.string()
}),
phone: z.string(),
__v: z.number()
})
export const cartSchema = z.object({
id: z.number(),
userId: z.number(),
date:z.string(),
products: z.object({
productId: z.number(),
quantity: z.number(),
}).array(),
__v: z.number()
})
export const productsSchema = z.object({
id: z.number(),
title: z.string(),
price: z.number(),
description: z.string(),
category: z.string(),
image: z.string(),
rating: z.object({
rate: z.number(),
count: z.number(),
})
})
export type userType = z.infer<typeof userSchema>
export type cartType = z.infer<typeof cartSchema>
export type productType = z.infer<typeof productsSchema>