-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
65 lines (51 loc) · 1.29 KB
/
types.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
54
55
56
57
58
59
60
61
62
63
64
65
import { Database } from '@/database.types'
export type Tables<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Row']
export type InsertTables<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Insert']
export type UpdateTables<T extends keyof Database['public']['Tables']> =
Database['public']['Tables'][T]['Update']
export type Enums<T extends keyof Database['public']['Enums']> =
Database['public']['Enums'][T]
// export type Product = {
// id: number
// image: string | null
// name: string
// price: number
// }
export type Product = Tables<'products'>
export type PizzaSize = 'S' | 'M' | 'L' | 'XL'
export type CartItem = {
id: string
product: Product
product_id: number
size: PizzaSize
quantity: number
}
export const OrderStatusList: OrderStatus[] = [
'NEW',
'COOKING',
'DELIVERING',
'DELIVERED',
]
export type OrderStatus = 'NEW' | 'COOKING' | 'DELIVERING' | 'DELIVERED'
export type Order = {
id: number
created_at: string
total: number
user_id: string
status: OrderStatus
order_items?: OrderItem[]
}
export type OrderItem = {
id: number
product_id: number
products: Product
order_id: number
size: PizzaSize
quantity: number
}
export type Profile = {
id: string
group: string
}