-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathRental.ts
120 lines (93 loc) · 3.2 KB
/
Rental.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import { inventoryId, type InventoryId } from './Inventory';
import { customerId, type CustomerId } from './Customer';
import { staffId, type StaffId } from './Staff';
import { z } from 'zod';
/** Identifier type for rental */
export type RentalId = number & { __flavor?: 'RentalId' };
/** Represents the table public.rental */
export default interface Rental {
/** Database type: pg_catalog.int4 */
rental_id: RentalId;
/** Database type: pg_catalog.timestamp */
rental_date: Date;
/** Database type: pg_catalog.int4 */
inventory_id: InventoryId;
/** Database type: pg_catalog.int2 */
customer_id: CustomerId;
/** Database type: pg_catalog.timestamp */
return_date: Date | null;
/** Database type: pg_catalog.int2 */
staff_id: StaffId;
/** Database type: pg_catalog.timestamp */
last_update: Date;
}
/** Represents the initializer for the table public.rental */
export interface RentalInitializer {
/**
* Database type: pg_catalog.int4
* Default value: nextval('rental_rental_id_seq'::regclass)
*/
rental_id?: RentalId;
/** Database type: pg_catalog.timestamp */
rental_date: Date;
/** Database type: pg_catalog.int4 */
inventory_id: InventoryId;
/** Database type: pg_catalog.int2 */
customer_id: CustomerId;
/** Database type: pg_catalog.timestamp */
return_date?: Date | null;
/** Database type: pg_catalog.int2 */
staff_id: StaffId;
/**
* Database type: pg_catalog.timestamp
* Default value: now()
*/
last_update?: Date;
}
/** Represents the mutator for the table public.rental */
export interface RentalMutator {
/** Database type: pg_catalog.int4 */
rental_id?: RentalId;
/** Database type: pg_catalog.timestamp */
rental_date?: Date;
/** Database type: pg_catalog.int4 */
inventory_id?: InventoryId;
/** Database type: pg_catalog.int2 */
customer_id?: CustomerId;
/** Database type: pg_catalog.timestamp */
return_date?: Date | null;
/** Database type: pg_catalog.int2 */
staff_id?: StaffId;
/** Database type: pg_catalog.timestamp */
last_update?: Date;
}
export const rentalId = z.number() as unknown as z.Schema<RentalId>;
export const rental = z.object({
rental_id: rentalId,
rental_date: z.date(),
inventory_id: inventoryId,
customer_id: customerId,
return_date: z.date().nullable(),
staff_id: staffId,
last_update: z.date(),
}) as unknown as z.Schema<Rental>;
export const rentalInitializer = z.object({
rental_id: rentalId.optional(),
rental_date: z.date(),
inventory_id: inventoryId,
customer_id: customerId,
return_date: z.date().optional().nullable(),
staff_id: staffId,
last_update: z.date().optional(),
}) as unknown as z.Schema<RentalInitializer>;
export const rentalMutator = z.object({
rental_id: rentalId.optional(),
rental_date: z.date().optional(),
inventory_id: inventoryId.optional(),
customer_id: customerId.optional(),
return_date: z.date().optional().nullable(),
staff_id: staffId.optional(),
last_update: z.date().optional(),
}) as unknown as z.Schema<RentalMutator>;