-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathStaff.ts
170 lines (131 loc) · 4.35 KB
/
Staff.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import { addressId, type AddressId } from './Address';
import bytea, { Bytea } from 'postgres-bytea';
import { z } from 'zod';
/** Identifier type for staff */
export type StaffId = number & { __flavor?: 'StaffId' };
/** Represents the table public.staff */
export default interface Staff {
/** Database type: pg_catalog.int4 */
staff_id: StaffId;
/** Database type: pg_catalog.varchar */
first_name: string;
/** Database type: pg_catalog.varchar */
last_name: string;
/** Database type: pg_catalog.int2 */
address_id: AddressId;
/** Database type: pg_catalog.varchar */
email: string | null;
/** Database type: pg_catalog.int2 */
store_id: number;
/** Database type: pg_catalog.bool */
active: boolean;
/** Database type: pg_catalog.varchar */
username: string;
/** Database type: pg_catalog.varchar */
password: string | null;
/** Database type: pg_catalog.timestamp */
last_update: Date;
/** Database type: pg_catalog.bytea */
picture: bytea | null;
}
/** Represents the initializer for the table public.staff */
export interface StaffInitializer {
/**
* Database type: pg_catalog.int4
* Default value: nextval('staff_staff_id_seq'::regclass)
*/
staff_id?: StaffId;
/** Database type: pg_catalog.varchar */
first_name: string;
/** Database type: pg_catalog.varchar */
last_name: string;
/** Database type: pg_catalog.int2 */
address_id: AddressId;
/** Database type: pg_catalog.varchar */
email?: string | null;
/** Database type: pg_catalog.int2 */
store_id: number;
/**
* Database type: pg_catalog.bool
* Default value: true
*/
active?: boolean;
/** Database type: pg_catalog.varchar */
username: string;
/** Database type: pg_catalog.varchar */
password?: string | null;
/**
* Database type: pg_catalog.timestamp
* Default value: now()
*/
last_update?: Date;
/** Database type: pg_catalog.bytea */
picture?: bytea | null;
}
/** Represents the mutator for the table public.staff */
export interface StaffMutator {
/** Database type: pg_catalog.int4 */
staff_id?: StaffId;
/** Database type: pg_catalog.varchar */
first_name?: string;
/** Database type: pg_catalog.varchar */
last_name?: string;
/** Database type: pg_catalog.int2 */
address_id?: AddressId;
/** Database type: pg_catalog.varchar */
email?: string | null;
/** Database type: pg_catalog.int2 */
store_id?: number;
/** Database type: pg_catalog.bool */
active?: boolean;
/** Database type: pg_catalog.varchar */
username?: string;
/** Database type: pg_catalog.varchar */
password?: string | null;
/** Database type: pg_catalog.timestamp */
last_update?: Date;
/** Database type: pg_catalog.bytea */
picture?: bytea | null;
}
export const staffId = z.number() as unknown as z.Schema<StaffId>;
export const staff = z.object({
staff_id: staffId,
first_name: z.string(),
last_name: z.string(),
address_id: addressId,
email: z.string().nullable(),
store_id: z.number(),
active: z.boolean(),
username: z.string(),
password: z.string().nullable(),
last_update: z.date(),
picture: z.custom<Bytea>(v => v).nullable(),
}) as unknown as z.Schema<Staff>;
export const staffInitializer = z.object({
staff_id: staffId.optional(),
first_name: z.string(),
last_name: z.string(),
address_id: addressId,
email: z.string().optional().nullable(),
store_id: z.number(),
active: z.boolean().optional(),
username: z.string(),
password: z.string().optional().nullable(),
last_update: z.date().optional(),
picture: z.custom<Bytea>(v => v).optional().nullable(),
}) as unknown as z.Schema<StaffInitializer>;
export const staffMutator = z.object({
staff_id: staffId.optional(),
first_name: z.string().optional(),
last_name: z.string().optional(),
address_id: addressId.optional(),
email: z.string().optional().nullable(),
store_id: z.number().optional(),
active: z.boolean().optional(),
username: z.string().optional(),
password: z.string().optional().nullable(),
last_update: z.date().optional(),
picture: z.custom<Bytea>(v => v).optional().nullable(),
}) as unknown as z.Schema<StaffMutator>;