@carbonorm/carbonnode 3.7.5 → 3.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/orm/builders/AggregateBuilder.d.ts +1 -0
- package/dist/api/types/dynamicFetching.d.ts +6 -6
- package/dist/api/types/ormInterfaces.d.ts +2 -2
- package/dist/api/utils/cacheManager.d.ts +1 -1
- package/dist/api/utils/normalizeSingularRequest.d.ts +10 -0
- package/dist/index.cjs.js +180 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +181 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -6
- package/scripts/assets/handlebars/C6.test.ts.handlebars +55 -80
- package/scripts/assets/handlebars/C6.ts.handlebars +28 -2
- package/scripts/generateRestBindings.cjs +17 -6
- package/scripts/generateRestBindings.ts +22 -8
- package/src/__tests__/fixtures/c6.fixture.ts +74 -0
- package/src/__tests__/normalizeSingularRequest.test.ts +95 -0
- package/src/__tests__/sakila-db/C6.js +1487 -0
- package/src/__tests__/sakila-db/C6.test.ts +63 -0
- package/src/__tests__/sakila-db/C6.ts +2206 -0
- package/src/__tests__/sakila-db/sakila-data.sql +46444 -0
- package/src/__tests__/sakila-db/sakila-schema.sql +686 -0
- package/src/__tests__/sakila-db/sakila.mwb +0 -0
- package/src/__tests__/sakila.generated.test.ts +46 -0
- package/src/__tests__/sqlBuilders.complex.test.ts +134 -0
- package/src/__tests__/sqlBuilders.test.ts +121 -0
- package/src/api/convertForRequestBody.ts +1 -1
- package/src/api/executors/HttpExecutor.ts +23 -9
- package/src/api/executors/SqlExecutor.ts +14 -1
- package/src/api/orm/builders/AggregateBuilder.ts +3 -0
- package/src/api/orm/builders/ConditionBuilder.ts +34 -11
- package/src/api/orm/builders/PaginationBuilder.ts +10 -4
- package/src/api/orm/queries/SelectQueryBuilder.ts +3 -0
- package/src/api/orm/queries/UpdateQueryBuilder.ts +2 -1
- package/src/api/types/dynamicFetching.ts +8 -8
- package/src/api/types/ormInterfaces.ts +3 -4
- package/src/api/utils/cacheManager.ts +1 -1
- package/src/api/utils/normalizeSingularRequest.ts +138 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,2206 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols,SpellCheckingInspection
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
C6Constants,
|
|
5
|
+
C6RestfulModel,
|
|
6
|
+
iC6Object,
|
|
7
|
+
iDynamicApiImport,
|
|
8
|
+
iRest,
|
|
9
|
+
OrmGenerics,
|
|
10
|
+
removePrefixIfExists,
|
|
11
|
+
restOrm,
|
|
12
|
+
} from "@carbonorm/carbonnode";
|
|
13
|
+
import type * as GeoJSON from "geojson";
|
|
14
|
+
|
|
15
|
+
export const RestTablePrefix = '';
|
|
16
|
+
|
|
17
|
+
export type RestTableNames = 'actor'
|
|
18
|
+
| 'address'
|
|
19
|
+
| 'category'
|
|
20
|
+
| 'city'
|
|
21
|
+
| 'country'
|
|
22
|
+
| 'customer'
|
|
23
|
+
| 'film'
|
|
24
|
+
| 'film_actor'
|
|
25
|
+
| 'film_category'
|
|
26
|
+
| 'film_text'
|
|
27
|
+
| 'inventory'
|
|
28
|
+
| 'language'
|
|
29
|
+
| 'payment'
|
|
30
|
+
| 'rental'
|
|
31
|
+
| 'staff'
|
|
32
|
+
| 'store';
|
|
33
|
+
|
|
34
|
+
export type RestShortTableNames = 'actor'
|
|
35
|
+
| 'address'
|
|
36
|
+
| 'category'
|
|
37
|
+
| 'city'
|
|
38
|
+
| 'country'
|
|
39
|
+
| 'customer'
|
|
40
|
+
| 'film'
|
|
41
|
+
| 'film_actor'
|
|
42
|
+
| 'film_category'
|
|
43
|
+
| 'film_text'
|
|
44
|
+
| 'inventory'
|
|
45
|
+
| 'language'
|
|
46
|
+
| 'payment'
|
|
47
|
+
| 'rental'
|
|
48
|
+
| 'staff'
|
|
49
|
+
| 'store';
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
CREATE TABLE `actor` (
|
|
54
|
+
`actor_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
55
|
+
`first_name` varchar(45) NOT NULL,
|
|
56
|
+
`last_name` varchar(45) NOT NULL,
|
|
57
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
58
|
+
PRIMARY KEY (`actor_id`),
|
|
59
|
+
KEY `idx_actor_last_name` (`last_name`)
|
|
60
|
+
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
61
|
+
**/
|
|
62
|
+
|
|
63
|
+
export interface iActor {
|
|
64
|
+
'actor_id'?: number;
|
|
65
|
+
'first_name'?: string;
|
|
66
|
+
'last_name'?: string;
|
|
67
|
+
'last_update'?: Date | number | string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type ActorPrimaryKeys =
|
|
71
|
+
'actor_id'
|
|
72
|
+
;
|
|
73
|
+
|
|
74
|
+
const actor:
|
|
75
|
+
C6RestfulModel<
|
|
76
|
+
'actor',
|
|
77
|
+
iActor,
|
|
78
|
+
ActorPrimaryKeys
|
|
79
|
+
> = {
|
|
80
|
+
TABLE_NAME: 'actor',
|
|
81
|
+
ACTOR_ID: 'actor.actor_id',
|
|
82
|
+
FIRST_NAME: 'actor.first_name',
|
|
83
|
+
LAST_NAME: 'actor.last_name',
|
|
84
|
+
LAST_UPDATE: 'actor.last_update',
|
|
85
|
+
PRIMARY: [
|
|
86
|
+
'actor.actor_id',
|
|
87
|
+
],
|
|
88
|
+
PRIMARY_SHORT: [
|
|
89
|
+
'actor_id',
|
|
90
|
+
],
|
|
91
|
+
COLUMNS: {
|
|
92
|
+
'actor.actor_id': 'actor_id',
|
|
93
|
+
'actor.first_name': 'first_name',
|
|
94
|
+
'actor.last_name': 'last_name',
|
|
95
|
+
'actor.last_update': 'last_update',
|
|
96
|
+
},
|
|
97
|
+
TYPE_VALIDATION: {
|
|
98
|
+
'actor.actor_id': {
|
|
99
|
+
MYSQL_TYPE: 'smallint',
|
|
100
|
+
MAX_LENGTH: '',
|
|
101
|
+
AUTO_INCREMENT: true,
|
|
102
|
+
SKIP_COLUMN_IN_POST: false
|
|
103
|
+
},
|
|
104
|
+
'actor.first_name': {
|
|
105
|
+
MYSQL_TYPE: 'varchar',
|
|
106
|
+
MAX_LENGTH: '45',
|
|
107
|
+
AUTO_INCREMENT: false,
|
|
108
|
+
SKIP_COLUMN_IN_POST: false
|
|
109
|
+
},
|
|
110
|
+
'actor.last_name': {
|
|
111
|
+
MYSQL_TYPE: 'varchar',
|
|
112
|
+
MAX_LENGTH: '45',
|
|
113
|
+
AUTO_INCREMENT: false,
|
|
114
|
+
SKIP_COLUMN_IN_POST: false
|
|
115
|
+
},
|
|
116
|
+
'actor.last_update': {
|
|
117
|
+
MYSQL_TYPE: 'timestamp',
|
|
118
|
+
MAX_LENGTH: '',
|
|
119
|
+
AUTO_INCREMENT: false,
|
|
120
|
+
SKIP_COLUMN_IN_POST: false
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
REGEX_VALIDATION: {
|
|
124
|
+
},
|
|
125
|
+
LIFECYCLE_HOOKS: {
|
|
126
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
127
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
128
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
129
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
130
|
+
},
|
|
131
|
+
TABLE_REFERENCES: {
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
TABLE_REFERENCED_BY: {
|
|
135
|
+
'actor_id': [{
|
|
136
|
+
TABLE: 'film_actor',
|
|
137
|
+
COLUMN: 'actor_id',
|
|
138
|
+
CONSTRAINT: 'fk_film_actor_actor',
|
|
139
|
+
},],
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
CREATE TABLE `address` (
|
|
145
|
+
`address_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
146
|
+
`address` varchar(50) NOT NULL,
|
|
147
|
+
`address2` varchar(50) DEFAULT NULL,
|
|
148
|
+
`district` varchar(20) NOT NULL,
|
|
149
|
+
`city_id` smallint unsigned NOT NULL,
|
|
150
|
+
`postal_code` varchar(10) DEFAULT NULL,
|
|
151
|
+
`phone` varchar(20) NOT NULL,
|
|
152
|
+
`location` geometry NOT NULL /!* SRID 0 *!/,
|
|
153
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
154
|
+
PRIMARY KEY (`address_id`),
|
|
155
|
+
KEY `idx_fk_city_id` (`city_id`),
|
|
156
|
+
SPATIAL KEY `idx_location` (`location`),
|
|
157
|
+
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
158
|
+
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
159
|
+
**/
|
|
160
|
+
|
|
161
|
+
export interface iAddress {
|
|
162
|
+
'address_id'?: number;
|
|
163
|
+
'address'?: string;
|
|
164
|
+
'address2'?: string | null;
|
|
165
|
+
'district'?: string;
|
|
166
|
+
'city_id'?: number;
|
|
167
|
+
'postal_code'?: string | null;
|
|
168
|
+
'phone'?: string;
|
|
169
|
+
'location'?: GeoJSON.Geometry;
|
|
170
|
+
'last_update'?: Date | number | string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export type AddressPrimaryKeys =
|
|
174
|
+
'address_id'
|
|
175
|
+
;
|
|
176
|
+
|
|
177
|
+
const address:
|
|
178
|
+
C6RestfulModel<
|
|
179
|
+
'address',
|
|
180
|
+
iAddress,
|
|
181
|
+
AddressPrimaryKeys
|
|
182
|
+
> = {
|
|
183
|
+
TABLE_NAME: 'address',
|
|
184
|
+
ADDRESS_ID: 'address.address_id',
|
|
185
|
+
ADDRESS: 'address.address',
|
|
186
|
+
ADDRESS2: 'address.address2',
|
|
187
|
+
DISTRICT: 'address.district',
|
|
188
|
+
CITY_ID: 'address.city_id',
|
|
189
|
+
POSTAL_CODE: 'address.postal_code',
|
|
190
|
+
PHONE: 'address.phone',
|
|
191
|
+
LOCATION: 'address.location',
|
|
192
|
+
LAST_UPDATE: 'address.last_update',
|
|
193
|
+
PRIMARY: [
|
|
194
|
+
'address.address_id',
|
|
195
|
+
],
|
|
196
|
+
PRIMARY_SHORT: [
|
|
197
|
+
'address_id',
|
|
198
|
+
],
|
|
199
|
+
COLUMNS: {
|
|
200
|
+
'address.address_id': 'address_id',
|
|
201
|
+
'address.address': 'address',
|
|
202
|
+
'address.address2': 'address2',
|
|
203
|
+
'address.district': 'district',
|
|
204
|
+
'address.city_id': 'city_id',
|
|
205
|
+
'address.postal_code': 'postal_code',
|
|
206
|
+
'address.phone': 'phone',
|
|
207
|
+
'address.location': 'location',
|
|
208
|
+
'address.last_update': 'last_update',
|
|
209
|
+
},
|
|
210
|
+
TYPE_VALIDATION: {
|
|
211
|
+
'address.address_id': {
|
|
212
|
+
MYSQL_TYPE: 'smallint',
|
|
213
|
+
MAX_LENGTH: '',
|
|
214
|
+
AUTO_INCREMENT: true,
|
|
215
|
+
SKIP_COLUMN_IN_POST: false
|
|
216
|
+
},
|
|
217
|
+
'address.address': {
|
|
218
|
+
MYSQL_TYPE: 'varchar',
|
|
219
|
+
MAX_LENGTH: '50',
|
|
220
|
+
AUTO_INCREMENT: false,
|
|
221
|
+
SKIP_COLUMN_IN_POST: false
|
|
222
|
+
},
|
|
223
|
+
'address.address2': {
|
|
224
|
+
MYSQL_TYPE: 'varchar',
|
|
225
|
+
MAX_LENGTH: '50',
|
|
226
|
+
AUTO_INCREMENT: false,
|
|
227
|
+
SKIP_COLUMN_IN_POST: false
|
|
228
|
+
},
|
|
229
|
+
'address.district': {
|
|
230
|
+
MYSQL_TYPE: 'varchar',
|
|
231
|
+
MAX_LENGTH: '20',
|
|
232
|
+
AUTO_INCREMENT: false,
|
|
233
|
+
SKIP_COLUMN_IN_POST: false
|
|
234
|
+
},
|
|
235
|
+
'address.city_id': {
|
|
236
|
+
MYSQL_TYPE: 'smallint',
|
|
237
|
+
MAX_LENGTH: '',
|
|
238
|
+
AUTO_INCREMENT: false,
|
|
239
|
+
SKIP_COLUMN_IN_POST: false
|
|
240
|
+
},
|
|
241
|
+
'address.postal_code': {
|
|
242
|
+
MYSQL_TYPE: 'varchar',
|
|
243
|
+
MAX_LENGTH: '10',
|
|
244
|
+
AUTO_INCREMENT: false,
|
|
245
|
+
SKIP_COLUMN_IN_POST: false
|
|
246
|
+
},
|
|
247
|
+
'address.phone': {
|
|
248
|
+
MYSQL_TYPE: 'varchar',
|
|
249
|
+
MAX_LENGTH: '20',
|
|
250
|
+
AUTO_INCREMENT: false,
|
|
251
|
+
SKIP_COLUMN_IN_POST: false
|
|
252
|
+
},
|
|
253
|
+
'address.location': {
|
|
254
|
+
MYSQL_TYPE: 'geometry',
|
|
255
|
+
MAX_LENGTH: '',
|
|
256
|
+
AUTO_INCREMENT: false,
|
|
257
|
+
SKIP_COLUMN_IN_POST: false
|
|
258
|
+
},
|
|
259
|
+
'address.last_update': {
|
|
260
|
+
MYSQL_TYPE: 'timestamp',
|
|
261
|
+
MAX_LENGTH: '',
|
|
262
|
+
AUTO_INCREMENT: false,
|
|
263
|
+
SKIP_COLUMN_IN_POST: false
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
REGEX_VALIDATION: {
|
|
267
|
+
},
|
|
268
|
+
LIFECYCLE_HOOKS: {
|
|
269
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
270
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
271
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
272
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
273
|
+
},
|
|
274
|
+
TABLE_REFERENCES: {
|
|
275
|
+
'city_id': [{
|
|
276
|
+
TABLE: 'city',
|
|
277
|
+
COLUMN: 'city_id',
|
|
278
|
+
CONSTRAINT: 'fk_address_city',
|
|
279
|
+
},],
|
|
280
|
+
},
|
|
281
|
+
TABLE_REFERENCED_BY: {
|
|
282
|
+
'address_id': [{
|
|
283
|
+
TABLE: 'customer',
|
|
284
|
+
COLUMN: 'address_id',
|
|
285
|
+
CONSTRAINT: 'fk_customer_address',
|
|
286
|
+
},{
|
|
287
|
+
TABLE: 'staff',
|
|
288
|
+
COLUMN: 'address_id',
|
|
289
|
+
CONSTRAINT: 'fk_staff_address',
|
|
290
|
+
},{
|
|
291
|
+
TABLE: 'store',
|
|
292
|
+
COLUMN: 'address_id',
|
|
293
|
+
CONSTRAINT: 'fk_store_address',
|
|
294
|
+
},],
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
CREATE TABLE `category` (
|
|
300
|
+
`category_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
|
301
|
+
`name` varchar(25) NOT NULL,
|
|
302
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
303
|
+
PRIMARY KEY (`category_id`)
|
|
304
|
+
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
305
|
+
**/
|
|
306
|
+
|
|
307
|
+
export interface iCategory {
|
|
308
|
+
'category_id'?: number;
|
|
309
|
+
'name'?: string;
|
|
310
|
+
'last_update'?: Date | number | string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export type CategoryPrimaryKeys =
|
|
314
|
+
'category_id'
|
|
315
|
+
;
|
|
316
|
+
|
|
317
|
+
const category:
|
|
318
|
+
C6RestfulModel<
|
|
319
|
+
'category',
|
|
320
|
+
iCategory,
|
|
321
|
+
CategoryPrimaryKeys
|
|
322
|
+
> = {
|
|
323
|
+
TABLE_NAME: 'category',
|
|
324
|
+
CATEGORY_ID: 'category.category_id',
|
|
325
|
+
NAME: 'category.name',
|
|
326
|
+
LAST_UPDATE: 'category.last_update',
|
|
327
|
+
PRIMARY: [
|
|
328
|
+
'category.category_id',
|
|
329
|
+
],
|
|
330
|
+
PRIMARY_SHORT: [
|
|
331
|
+
'category_id',
|
|
332
|
+
],
|
|
333
|
+
COLUMNS: {
|
|
334
|
+
'category.category_id': 'category_id',
|
|
335
|
+
'category.name': 'name',
|
|
336
|
+
'category.last_update': 'last_update',
|
|
337
|
+
},
|
|
338
|
+
TYPE_VALIDATION: {
|
|
339
|
+
'category.category_id': {
|
|
340
|
+
MYSQL_TYPE: 'tinyint',
|
|
341
|
+
MAX_LENGTH: '',
|
|
342
|
+
AUTO_INCREMENT: true,
|
|
343
|
+
SKIP_COLUMN_IN_POST: false
|
|
344
|
+
},
|
|
345
|
+
'category.name': {
|
|
346
|
+
MYSQL_TYPE: 'varchar',
|
|
347
|
+
MAX_LENGTH: '25',
|
|
348
|
+
AUTO_INCREMENT: false,
|
|
349
|
+
SKIP_COLUMN_IN_POST: false
|
|
350
|
+
},
|
|
351
|
+
'category.last_update': {
|
|
352
|
+
MYSQL_TYPE: 'timestamp',
|
|
353
|
+
MAX_LENGTH: '',
|
|
354
|
+
AUTO_INCREMENT: false,
|
|
355
|
+
SKIP_COLUMN_IN_POST: false
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
REGEX_VALIDATION: {
|
|
359
|
+
},
|
|
360
|
+
LIFECYCLE_HOOKS: {
|
|
361
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
362
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
363
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
364
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
365
|
+
},
|
|
366
|
+
TABLE_REFERENCES: {
|
|
367
|
+
|
|
368
|
+
},
|
|
369
|
+
TABLE_REFERENCED_BY: {
|
|
370
|
+
'category_id': [{
|
|
371
|
+
TABLE: 'film_category',
|
|
372
|
+
COLUMN: 'category_id',
|
|
373
|
+
CONSTRAINT: 'fk_film_category_category',
|
|
374
|
+
},],
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
CREATE TABLE `city` (
|
|
380
|
+
`city_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
381
|
+
`city` varchar(50) NOT NULL,
|
|
382
|
+
`country_id` smallint unsigned NOT NULL,
|
|
383
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
384
|
+
PRIMARY KEY (`city_id`),
|
|
385
|
+
KEY `idx_fk_country_id` (`country_id`),
|
|
386
|
+
CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
387
|
+
) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
388
|
+
**/
|
|
389
|
+
|
|
390
|
+
export interface iCity {
|
|
391
|
+
'city_id'?: number;
|
|
392
|
+
'city'?: string;
|
|
393
|
+
'country_id'?: number;
|
|
394
|
+
'last_update'?: Date | number | string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type CityPrimaryKeys =
|
|
398
|
+
'city_id'
|
|
399
|
+
;
|
|
400
|
+
|
|
401
|
+
const city:
|
|
402
|
+
C6RestfulModel<
|
|
403
|
+
'city',
|
|
404
|
+
iCity,
|
|
405
|
+
CityPrimaryKeys
|
|
406
|
+
> = {
|
|
407
|
+
TABLE_NAME: 'city',
|
|
408
|
+
CITY_ID: 'city.city_id',
|
|
409
|
+
CITY: 'city.city',
|
|
410
|
+
COUNTRY_ID: 'city.country_id',
|
|
411
|
+
LAST_UPDATE: 'city.last_update',
|
|
412
|
+
PRIMARY: [
|
|
413
|
+
'city.city_id',
|
|
414
|
+
],
|
|
415
|
+
PRIMARY_SHORT: [
|
|
416
|
+
'city_id',
|
|
417
|
+
],
|
|
418
|
+
COLUMNS: {
|
|
419
|
+
'city.city_id': 'city_id',
|
|
420
|
+
'city.city': 'city',
|
|
421
|
+
'city.country_id': 'country_id',
|
|
422
|
+
'city.last_update': 'last_update',
|
|
423
|
+
},
|
|
424
|
+
TYPE_VALIDATION: {
|
|
425
|
+
'city.city_id': {
|
|
426
|
+
MYSQL_TYPE: 'smallint',
|
|
427
|
+
MAX_LENGTH: '',
|
|
428
|
+
AUTO_INCREMENT: true,
|
|
429
|
+
SKIP_COLUMN_IN_POST: false
|
|
430
|
+
},
|
|
431
|
+
'city.city': {
|
|
432
|
+
MYSQL_TYPE: 'varchar',
|
|
433
|
+
MAX_LENGTH: '50',
|
|
434
|
+
AUTO_INCREMENT: false,
|
|
435
|
+
SKIP_COLUMN_IN_POST: false
|
|
436
|
+
},
|
|
437
|
+
'city.country_id': {
|
|
438
|
+
MYSQL_TYPE: 'smallint',
|
|
439
|
+
MAX_LENGTH: '',
|
|
440
|
+
AUTO_INCREMENT: false,
|
|
441
|
+
SKIP_COLUMN_IN_POST: false
|
|
442
|
+
},
|
|
443
|
+
'city.last_update': {
|
|
444
|
+
MYSQL_TYPE: 'timestamp',
|
|
445
|
+
MAX_LENGTH: '',
|
|
446
|
+
AUTO_INCREMENT: false,
|
|
447
|
+
SKIP_COLUMN_IN_POST: false
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
REGEX_VALIDATION: {
|
|
451
|
+
},
|
|
452
|
+
LIFECYCLE_HOOKS: {
|
|
453
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
454
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
455
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
456
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
457
|
+
},
|
|
458
|
+
TABLE_REFERENCES: {
|
|
459
|
+
'country_id': [{
|
|
460
|
+
TABLE: 'country',
|
|
461
|
+
COLUMN: 'country_id',
|
|
462
|
+
CONSTRAINT: 'fk_city_country',
|
|
463
|
+
},],
|
|
464
|
+
},
|
|
465
|
+
TABLE_REFERENCED_BY: {
|
|
466
|
+
'city_id': [{
|
|
467
|
+
TABLE: 'address',
|
|
468
|
+
COLUMN: 'city_id',
|
|
469
|
+
CONSTRAINT: 'fk_address_city',
|
|
470
|
+
},],
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
CREATE TABLE `country` (
|
|
476
|
+
`country_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
477
|
+
`country` varchar(50) NOT NULL,
|
|
478
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
479
|
+
PRIMARY KEY (`country_id`)
|
|
480
|
+
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
481
|
+
**/
|
|
482
|
+
|
|
483
|
+
export interface iCountry {
|
|
484
|
+
'country_id'?: number;
|
|
485
|
+
'country'?: string;
|
|
486
|
+
'last_update'?: Date | number | string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export type CountryPrimaryKeys =
|
|
490
|
+
'country_id'
|
|
491
|
+
;
|
|
492
|
+
|
|
493
|
+
const country:
|
|
494
|
+
C6RestfulModel<
|
|
495
|
+
'country',
|
|
496
|
+
iCountry,
|
|
497
|
+
CountryPrimaryKeys
|
|
498
|
+
> = {
|
|
499
|
+
TABLE_NAME: 'country',
|
|
500
|
+
COUNTRY_ID: 'country.country_id',
|
|
501
|
+
COUNTRY: 'country.country',
|
|
502
|
+
LAST_UPDATE: 'country.last_update',
|
|
503
|
+
PRIMARY: [
|
|
504
|
+
'country.country_id',
|
|
505
|
+
],
|
|
506
|
+
PRIMARY_SHORT: [
|
|
507
|
+
'country_id',
|
|
508
|
+
],
|
|
509
|
+
COLUMNS: {
|
|
510
|
+
'country.country_id': 'country_id',
|
|
511
|
+
'country.country': 'country',
|
|
512
|
+
'country.last_update': 'last_update',
|
|
513
|
+
},
|
|
514
|
+
TYPE_VALIDATION: {
|
|
515
|
+
'country.country_id': {
|
|
516
|
+
MYSQL_TYPE: 'smallint',
|
|
517
|
+
MAX_LENGTH: '',
|
|
518
|
+
AUTO_INCREMENT: true,
|
|
519
|
+
SKIP_COLUMN_IN_POST: false
|
|
520
|
+
},
|
|
521
|
+
'country.country': {
|
|
522
|
+
MYSQL_TYPE: 'varchar',
|
|
523
|
+
MAX_LENGTH: '50',
|
|
524
|
+
AUTO_INCREMENT: false,
|
|
525
|
+
SKIP_COLUMN_IN_POST: false
|
|
526
|
+
},
|
|
527
|
+
'country.last_update': {
|
|
528
|
+
MYSQL_TYPE: 'timestamp',
|
|
529
|
+
MAX_LENGTH: '',
|
|
530
|
+
AUTO_INCREMENT: false,
|
|
531
|
+
SKIP_COLUMN_IN_POST: false
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
REGEX_VALIDATION: {
|
|
535
|
+
},
|
|
536
|
+
LIFECYCLE_HOOKS: {
|
|
537
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
538
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
539
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
540
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
541
|
+
},
|
|
542
|
+
TABLE_REFERENCES: {
|
|
543
|
+
|
|
544
|
+
},
|
|
545
|
+
TABLE_REFERENCED_BY: {
|
|
546
|
+
'country_id': [{
|
|
547
|
+
TABLE: 'city',
|
|
548
|
+
COLUMN: 'country_id',
|
|
549
|
+
CONSTRAINT: 'fk_city_country',
|
|
550
|
+
},],
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
CREATE TABLE `customer` (
|
|
556
|
+
`customer_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
557
|
+
`store_id` tinyint unsigned NOT NULL,
|
|
558
|
+
`first_name` varchar(45) NOT NULL,
|
|
559
|
+
`last_name` varchar(45) NOT NULL,
|
|
560
|
+
`email` varchar(50) DEFAULT NULL,
|
|
561
|
+
`address_id` smallint unsigned NOT NULL,
|
|
562
|
+
`active` tinyint(1) NOT NULL DEFAULT '1',
|
|
563
|
+
`create_date` datetime NOT NULL,
|
|
564
|
+
`last_update` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
565
|
+
PRIMARY KEY (`customer_id`),
|
|
566
|
+
KEY `idx_fk_store_id` (`store_id`),
|
|
567
|
+
KEY `idx_fk_address_id` (`address_id`),
|
|
568
|
+
KEY `idx_last_name` (`last_name`),
|
|
569
|
+
CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
570
|
+
CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
571
|
+
) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
572
|
+
**/
|
|
573
|
+
|
|
574
|
+
export interface iCustomer {
|
|
575
|
+
'customer_id'?: number;
|
|
576
|
+
'store_id'?: number;
|
|
577
|
+
'first_name'?: string;
|
|
578
|
+
'last_name'?: string;
|
|
579
|
+
'email'?: string | null;
|
|
580
|
+
'address_id'?: number;
|
|
581
|
+
'active'?: number;
|
|
582
|
+
'create_date'?: Date | number | string;
|
|
583
|
+
'last_update'?: Date | number | string | null;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export type CustomerPrimaryKeys =
|
|
587
|
+
'customer_id'
|
|
588
|
+
;
|
|
589
|
+
|
|
590
|
+
const customer:
|
|
591
|
+
C6RestfulModel<
|
|
592
|
+
'customer',
|
|
593
|
+
iCustomer,
|
|
594
|
+
CustomerPrimaryKeys
|
|
595
|
+
> = {
|
|
596
|
+
TABLE_NAME: 'customer',
|
|
597
|
+
CUSTOMER_ID: 'customer.customer_id',
|
|
598
|
+
STORE_ID: 'customer.store_id',
|
|
599
|
+
FIRST_NAME: 'customer.first_name',
|
|
600
|
+
LAST_NAME: 'customer.last_name',
|
|
601
|
+
EMAIL: 'customer.email',
|
|
602
|
+
ADDRESS_ID: 'customer.address_id',
|
|
603
|
+
ACTIVE: 'customer.active',
|
|
604
|
+
CREATE_DATE: 'customer.create_date',
|
|
605
|
+
LAST_UPDATE: 'customer.last_update',
|
|
606
|
+
PRIMARY: [
|
|
607
|
+
'customer.customer_id',
|
|
608
|
+
],
|
|
609
|
+
PRIMARY_SHORT: [
|
|
610
|
+
'customer_id',
|
|
611
|
+
],
|
|
612
|
+
COLUMNS: {
|
|
613
|
+
'customer.customer_id': 'customer_id',
|
|
614
|
+
'customer.store_id': 'store_id',
|
|
615
|
+
'customer.first_name': 'first_name',
|
|
616
|
+
'customer.last_name': 'last_name',
|
|
617
|
+
'customer.email': 'email',
|
|
618
|
+
'customer.address_id': 'address_id',
|
|
619
|
+
'customer.active': 'active',
|
|
620
|
+
'customer.create_date': 'create_date',
|
|
621
|
+
'customer.last_update': 'last_update',
|
|
622
|
+
},
|
|
623
|
+
TYPE_VALIDATION: {
|
|
624
|
+
'customer.customer_id': {
|
|
625
|
+
MYSQL_TYPE: 'smallint',
|
|
626
|
+
MAX_LENGTH: '',
|
|
627
|
+
AUTO_INCREMENT: true,
|
|
628
|
+
SKIP_COLUMN_IN_POST: false
|
|
629
|
+
},
|
|
630
|
+
'customer.store_id': {
|
|
631
|
+
MYSQL_TYPE: 'tinyint',
|
|
632
|
+
MAX_LENGTH: '',
|
|
633
|
+
AUTO_INCREMENT: false,
|
|
634
|
+
SKIP_COLUMN_IN_POST: false
|
|
635
|
+
},
|
|
636
|
+
'customer.first_name': {
|
|
637
|
+
MYSQL_TYPE: 'varchar',
|
|
638
|
+
MAX_LENGTH: '45',
|
|
639
|
+
AUTO_INCREMENT: false,
|
|
640
|
+
SKIP_COLUMN_IN_POST: false
|
|
641
|
+
},
|
|
642
|
+
'customer.last_name': {
|
|
643
|
+
MYSQL_TYPE: 'varchar',
|
|
644
|
+
MAX_LENGTH: '45',
|
|
645
|
+
AUTO_INCREMENT: false,
|
|
646
|
+
SKIP_COLUMN_IN_POST: false
|
|
647
|
+
},
|
|
648
|
+
'customer.email': {
|
|
649
|
+
MYSQL_TYPE: 'varchar',
|
|
650
|
+
MAX_LENGTH: '50',
|
|
651
|
+
AUTO_INCREMENT: false,
|
|
652
|
+
SKIP_COLUMN_IN_POST: false
|
|
653
|
+
},
|
|
654
|
+
'customer.address_id': {
|
|
655
|
+
MYSQL_TYPE: 'smallint',
|
|
656
|
+
MAX_LENGTH: '',
|
|
657
|
+
AUTO_INCREMENT: false,
|
|
658
|
+
SKIP_COLUMN_IN_POST: false
|
|
659
|
+
},
|
|
660
|
+
'customer.active': {
|
|
661
|
+
MYSQL_TYPE: 'tinyint',
|
|
662
|
+
MAX_LENGTH: '1',
|
|
663
|
+
AUTO_INCREMENT: false,
|
|
664
|
+
SKIP_COLUMN_IN_POST: false
|
|
665
|
+
},
|
|
666
|
+
'customer.create_date': {
|
|
667
|
+
MYSQL_TYPE: 'datetime',
|
|
668
|
+
MAX_LENGTH: '',
|
|
669
|
+
AUTO_INCREMENT: false,
|
|
670
|
+
SKIP_COLUMN_IN_POST: false
|
|
671
|
+
},
|
|
672
|
+
'customer.last_update': {
|
|
673
|
+
MYSQL_TYPE: 'timestamp',
|
|
674
|
+
MAX_LENGTH: '',
|
|
675
|
+
AUTO_INCREMENT: false,
|
|
676
|
+
SKIP_COLUMN_IN_POST: false
|
|
677
|
+
},
|
|
678
|
+
},
|
|
679
|
+
REGEX_VALIDATION: {
|
|
680
|
+
},
|
|
681
|
+
LIFECYCLE_HOOKS: {
|
|
682
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
683
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
684
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
685
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
686
|
+
},
|
|
687
|
+
TABLE_REFERENCES: {
|
|
688
|
+
'address_id': [{
|
|
689
|
+
TABLE: 'address',
|
|
690
|
+
COLUMN: 'address_id',
|
|
691
|
+
CONSTRAINT: 'fk_customer_address',
|
|
692
|
+
},],'store_id': [{
|
|
693
|
+
TABLE: 'store',
|
|
694
|
+
COLUMN: 'store_id',
|
|
695
|
+
CONSTRAINT: 'fk_customer_store',
|
|
696
|
+
},],
|
|
697
|
+
},
|
|
698
|
+
TABLE_REFERENCED_BY: {
|
|
699
|
+
'customer_id': [{
|
|
700
|
+
TABLE: 'payment',
|
|
701
|
+
COLUMN: 'customer_id',
|
|
702
|
+
CONSTRAINT: 'fk_payment_customer',
|
|
703
|
+
},{
|
|
704
|
+
TABLE: 'rental',
|
|
705
|
+
COLUMN: 'customer_id',
|
|
706
|
+
CONSTRAINT: 'fk_rental_customer',
|
|
707
|
+
},],
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
CREATE TABLE `film` (
|
|
713
|
+
`film_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
714
|
+
`title` varchar(128) NOT NULL,
|
|
715
|
+
`description` text,
|
|
716
|
+
`release_year` year DEFAULT NULL,
|
|
717
|
+
`language_id` tinyint unsigned NOT NULL,
|
|
718
|
+
`original_language_id` tinyint unsigned DEFAULT NULL,
|
|
719
|
+
`rental_duration` tinyint unsigned NOT NULL DEFAULT '3',
|
|
720
|
+
`rental_rate` decimal(4,2) NOT NULL DEFAULT '4.99',
|
|
721
|
+
`length` smallint unsigned DEFAULT NULL,
|
|
722
|
+
`replacement_cost` decimal(5,2) NOT NULL DEFAULT '19.99',
|
|
723
|
+
`rating` enum('G','PG','PG-13','R','NC-17') DEFAULT 'G',
|
|
724
|
+
`special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
|
|
725
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
726
|
+
PRIMARY KEY (`film_id`),
|
|
727
|
+
KEY `idx_title` (`title`),
|
|
728
|
+
KEY `idx_fk_language_id` (`language_id`),
|
|
729
|
+
KEY `idx_fk_original_language_id` (`original_language_id`),
|
|
730
|
+
CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
731
|
+
CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
732
|
+
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
733
|
+
**/
|
|
734
|
+
|
|
735
|
+
export interface iFilm {
|
|
736
|
+
'film_id'?: number;
|
|
737
|
+
'title'?: string;
|
|
738
|
+
'description'?: string | null;
|
|
739
|
+
'release_year'?: Date | number | string | null;
|
|
740
|
+
'language_id'?: number;
|
|
741
|
+
'original_language_id'?: number | null;
|
|
742
|
+
'rental_duration'?: number;
|
|
743
|
+
'rental_rate'?: number;
|
|
744
|
+
'length'?: number | null;
|
|
745
|
+
'replacement_cost'?: number;
|
|
746
|
+
'rating'?: 'G' | 'PG' | 'PG-13' | 'R' | 'NC-17' | null;
|
|
747
|
+
'special_features'?: string | null;
|
|
748
|
+
'last_update'?: Date | number | string;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export type FilmPrimaryKeys =
|
|
752
|
+
'film_id'
|
|
753
|
+
;
|
|
754
|
+
|
|
755
|
+
const film:
|
|
756
|
+
C6RestfulModel<
|
|
757
|
+
'film',
|
|
758
|
+
iFilm,
|
|
759
|
+
FilmPrimaryKeys
|
|
760
|
+
> = {
|
|
761
|
+
TABLE_NAME: 'film',
|
|
762
|
+
FILM_ID: 'film.film_id',
|
|
763
|
+
TITLE: 'film.title',
|
|
764
|
+
DESCRIPTION: 'film.description',
|
|
765
|
+
RELEASE_YEAR: 'film.release_year',
|
|
766
|
+
LANGUAGE_ID: 'film.language_id',
|
|
767
|
+
ORIGINAL_LANGUAGE_ID: 'film.original_language_id',
|
|
768
|
+
RENTAL_DURATION: 'film.rental_duration',
|
|
769
|
+
RENTAL_RATE: 'film.rental_rate',
|
|
770
|
+
LENGTH: 'film.length',
|
|
771
|
+
REPLACEMENT_COST: 'film.replacement_cost',
|
|
772
|
+
RATING: 'film.rating',
|
|
773
|
+
SPECIAL_FEATURES: 'film.special_features',
|
|
774
|
+
LAST_UPDATE: 'film.last_update',
|
|
775
|
+
PRIMARY: [
|
|
776
|
+
'film.film_id',
|
|
777
|
+
],
|
|
778
|
+
PRIMARY_SHORT: [
|
|
779
|
+
'film_id',
|
|
780
|
+
],
|
|
781
|
+
COLUMNS: {
|
|
782
|
+
'film.film_id': 'film_id',
|
|
783
|
+
'film.title': 'title',
|
|
784
|
+
'film.description': 'description',
|
|
785
|
+
'film.release_year': 'release_year',
|
|
786
|
+
'film.language_id': 'language_id',
|
|
787
|
+
'film.original_language_id': 'original_language_id',
|
|
788
|
+
'film.rental_duration': 'rental_duration',
|
|
789
|
+
'film.rental_rate': 'rental_rate',
|
|
790
|
+
'film.length': 'length',
|
|
791
|
+
'film.replacement_cost': 'replacement_cost',
|
|
792
|
+
'film.rating': 'rating',
|
|
793
|
+
'film.special_features': 'special_features',
|
|
794
|
+
'film.last_update': 'last_update',
|
|
795
|
+
},
|
|
796
|
+
TYPE_VALIDATION: {
|
|
797
|
+
'film.film_id': {
|
|
798
|
+
MYSQL_TYPE: 'smallint',
|
|
799
|
+
MAX_LENGTH: '',
|
|
800
|
+
AUTO_INCREMENT: true,
|
|
801
|
+
SKIP_COLUMN_IN_POST: false
|
|
802
|
+
},
|
|
803
|
+
'film.title': {
|
|
804
|
+
MYSQL_TYPE: 'varchar',
|
|
805
|
+
MAX_LENGTH: '128',
|
|
806
|
+
AUTO_INCREMENT: false,
|
|
807
|
+
SKIP_COLUMN_IN_POST: false
|
|
808
|
+
},
|
|
809
|
+
'film.description': {
|
|
810
|
+
MYSQL_TYPE: 'text',
|
|
811
|
+
MAX_LENGTH: '',
|
|
812
|
+
AUTO_INCREMENT: false,
|
|
813
|
+
SKIP_COLUMN_IN_POST: true
|
|
814
|
+
},
|
|
815
|
+
'film.release_year': {
|
|
816
|
+
MYSQL_TYPE: 'year',
|
|
817
|
+
MAX_LENGTH: '',
|
|
818
|
+
AUTO_INCREMENT: false,
|
|
819
|
+
SKIP_COLUMN_IN_POST: false
|
|
820
|
+
},
|
|
821
|
+
'film.language_id': {
|
|
822
|
+
MYSQL_TYPE: 'tinyint',
|
|
823
|
+
MAX_LENGTH: '',
|
|
824
|
+
AUTO_INCREMENT: false,
|
|
825
|
+
SKIP_COLUMN_IN_POST: false
|
|
826
|
+
},
|
|
827
|
+
'film.original_language_id': {
|
|
828
|
+
MYSQL_TYPE: 'tinyint',
|
|
829
|
+
MAX_LENGTH: '',
|
|
830
|
+
AUTO_INCREMENT: false,
|
|
831
|
+
SKIP_COLUMN_IN_POST: false
|
|
832
|
+
},
|
|
833
|
+
'film.rental_duration': {
|
|
834
|
+
MYSQL_TYPE: 'tinyint',
|
|
835
|
+
MAX_LENGTH: '',
|
|
836
|
+
AUTO_INCREMENT: false,
|
|
837
|
+
SKIP_COLUMN_IN_POST: false
|
|
838
|
+
},
|
|
839
|
+
'film.rental_rate': {
|
|
840
|
+
MYSQL_TYPE: 'decimal',
|
|
841
|
+
MAX_LENGTH: '4,2',
|
|
842
|
+
AUTO_INCREMENT: false,
|
|
843
|
+
SKIP_COLUMN_IN_POST: false
|
|
844
|
+
},
|
|
845
|
+
'film.length': {
|
|
846
|
+
MYSQL_TYPE: 'smallint',
|
|
847
|
+
MAX_LENGTH: '',
|
|
848
|
+
AUTO_INCREMENT: false,
|
|
849
|
+
SKIP_COLUMN_IN_POST: false
|
|
850
|
+
},
|
|
851
|
+
'film.replacement_cost': {
|
|
852
|
+
MYSQL_TYPE: 'decimal',
|
|
853
|
+
MAX_LENGTH: '5,2',
|
|
854
|
+
AUTO_INCREMENT: false,
|
|
855
|
+
SKIP_COLUMN_IN_POST: false
|
|
856
|
+
},
|
|
857
|
+
'film.rating': {
|
|
858
|
+
MYSQL_TYPE: 'enum',
|
|
859
|
+
MAX_LENGTH: ''G','PG','PG-13','R','NC-17'',
|
|
860
|
+
AUTO_INCREMENT: false,
|
|
861
|
+
SKIP_COLUMN_IN_POST: false
|
|
862
|
+
},
|
|
863
|
+
'film.special_features': {
|
|
864
|
+
MYSQL_TYPE: 'set',
|
|
865
|
+
MAX_LENGTH: ''Trailers','Commentaries','Deleted Scenes','Behind the Scenes'',
|
|
866
|
+
AUTO_INCREMENT: false,
|
|
867
|
+
SKIP_COLUMN_IN_POST: false
|
|
868
|
+
},
|
|
869
|
+
'film.last_update': {
|
|
870
|
+
MYSQL_TYPE: 'timestamp',
|
|
871
|
+
MAX_LENGTH: '',
|
|
872
|
+
AUTO_INCREMENT: false,
|
|
873
|
+
SKIP_COLUMN_IN_POST: false
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
REGEX_VALIDATION: {
|
|
877
|
+
},
|
|
878
|
+
LIFECYCLE_HOOKS: {
|
|
879
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
880
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
881
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
882
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
883
|
+
},
|
|
884
|
+
TABLE_REFERENCES: {
|
|
885
|
+
'language_id': [{
|
|
886
|
+
TABLE: 'language',
|
|
887
|
+
COLUMN: 'language_id',
|
|
888
|
+
CONSTRAINT: 'fk_film_language',
|
|
889
|
+
},],'original_language_id': [{
|
|
890
|
+
TABLE: 'language',
|
|
891
|
+
COLUMN: 'language_id',
|
|
892
|
+
CONSTRAINT: 'fk_film_language_original',
|
|
893
|
+
},],
|
|
894
|
+
},
|
|
895
|
+
TABLE_REFERENCED_BY: {
|
|
896
|
+
'film_id': [{
|
|
897
|
+
TABLE: 'film_actor',
|
|
898
|
+
COLUMN: 'film_id',
|
|
899
|
+
CONSTRAINT: 'fk_film_actor_film',
|
|
900
|
+
},{
|
|
901
|
+
TABLE: 'film_category',
|
|
902
|
+
COLUMN: 'film_id',
|
|
903
|
+
CONSTRAINT: 'fk_film_category_film',
|
|
904
|
+
},{
|
|
905
|
+
TABLE: 'inventory',
|
|
906
|
+
COLUMN: 'film_id',
|
|
907
|
+
CONSTRAINT: 'fk_inventory_film',
|
|
908
|
+
},],
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
CREATE TABLE `film_actor` (
|
|
914
|
+
`actor_id` smallint unsigned NOT NULL,
|
|
915
|
+
`film_id` smallint unsigned NOT NULL,
|
|
916
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
917
|
+
PRIMARY KEY (`actor_id`,`film_id`),
|
|
918
|
+
KEY `idx_fk_film_id` (`film_id`),
|
|
919
|
+
CONSTRAINT `fk_film_actor_actor` FOREIGN KEY (`actor_id`) REFERENCES `actor` (`actor_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
920
|
+
CONSTRAINT `fk_film_actor_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
921
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
922
|
+
**/
|
|
923
|
+
|
|
924
|
+
export interface iFilm_Actor {
|
|
925
|
+
'actor_id'?: number;
|
|
926
|
+
'film_id'?: number;
|
|
927
|
+
'last_update'?: Date | number | string;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
export type Film_ActorPrimaryKeys =
|
|
931
|
+
'actor_id' |
|
|
932
|
+
'film_id'
|
|
933
|
+
;
|
|
934
|
+
|
|
935
|
+
const film_actor:
|
|
936
|
+
C6RestfulModel<
|
|
937
|
+
'film_actor',
|
|
938
|
+
iFilm_Actor,
|
|
939
|
+
Film_ActorPrimaryKeys
|
|
940
|
+
> = {
|
|
941
|
+
TABLE_NAME: 'film_actor',
|
|
942
|
+
ACTOR_ID: 'film_actor.actor_id',
|
|
943
|
+
FILM_ID: 'film_actor.film_id',
|
|
944
|
+
LAST_UPDATE: 'film_actor.last_update',
|
|
945
|
+
PRIMARY: [
|
|
946
|
+
'film_actor.actor_id',
|
|
947
|
+
'film_actor.film_id',
|
|
948
|
+
],
|
|
949
|
+
PRIMARY_SHORT: [
|
|
950
|
+
'actor_id',
|
|
951
|
+
'film_id',
|
|
952
|
+
],
|
|
953
|
+
COLUMNS: {
|
|
954
|
+
'film_actor.actor_id': 'actor_id',
|
|
955
|
+
'film_actor.film_id': 'film_id',
|
|
956
|
+
'film_actor.last_update': 'last_update',
|
|
957
|
+
},
|
|
958
|
+
TYPE_VALIDATION: {
|
|
959
|
+
'film_actor.actor_id': {
|
|
960
|
+
MYSQL_TYPE: 'smallint',
|
|
961
|
+
MAX_LENGTH: '',
|
|
962
|
+
AUTO_INCREMENT: false,
|
|
963
|
+
SKIP_COLUMN_IN_POST: false
|
|
964
|
+
},
|
|
965
|
+
'film_actor.film_id': {
|
|
966
|
+
MYSQL_TYPE: 'smallint',
|
|
967
|
+
MAX_LENGTH: '',
|
|
968
|
+
AUTO_INCREMENT: false,
|
|
969
|
+
SKIP_COLUMN_IN_POST: false
|
|
970
|
+
},
|
|
971
|
+
'film_actor.last_update': {
|
|
972
|
+
MYSQL_TYPE: 'timestamp',
|
|
973
|
+
MAX_LENGTH: '',
|
|
974
|
+
AUTO_INCREMENT: false,
|
|
975
|
+
SKIP_COLUMN_IN_POST: false
|
|
976
|
+
},
|
|
977
|
+
},
|
|
978
|
+
REGEX_VALIDATION: {
|
|
979
|
+
},
|
|
980
|
+
LIFECYCLE_HOOKS: {
|
|
981
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
982
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
983
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
984
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
985
|
+
},
|
|
986
|
+
TABLE_REFERENCES: {
|
|
987
|
+
'actor_id': [{
|
|
988
|
+
TABLE: 'actor',
|
|
989
|
+
COLUMN: 'actor_id',
|
|
990
|
+
CONSTRAINT: 'fk_film_actor_actor',
|
|
991
|
+
},],'film_id': [{
|
|
992
|
+
TABLE: 'film',
|
|
993
|
+
COLUMN: 'film_id',
|
|
994
|
+
CONSTRAINT: 'fk_film_actor_film',
|
|
995
|
+
},],
|
|
996
|
+
},
|
|
997
|
+
TABLE_REFERENCED_BY: {
|
|
998
|
+
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
CREATE TABLE `film_category` (
|
|
1004
|
+
`film_id` smallint unsigned NOT NULL,
|
|
1005
|
+
`category_id` tinyint unsigned NOT NULL,
|
|
1006
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1007
|
+
PRIMARY KEY (`film_id`,`category_id`),
|
|
1008
|
+
KEY `fk_film_category_category` (`category_id`),
|
|
1009
|
+
CONSTRAINT `fk_film_category_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1010
|
+
CONSTRAINT `fk_film_category_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1011
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1012
|
+
**/
|
|
1013
|
+
|
|
1014
|
+
export interface iFilm_Category {
|
|
1015
|
+
'film_id'?: number;
|
|
1016
|
+
'category_id'?: number;
|
|
1017
|
+
'last_update'?: Date | number | string;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
export type Film_CategoryPrimaryKeys =
|
|
1021
|
+
'film_id' |
|
|
1022
|
+
'category_id'
|
|
1023
|
+
;
|
|
1024
|
+
|
|
1025
|
+
const film_category:
|
|
1026
|
+
C6RestfulModel<
|
|
1027
|
+
'film_category',
|
|
1028
|
+
iFilm_Category,
|
|
1029
|
+
Film_CategoryPrimaryKeys
|
|
1030
|
+
> = {
|
|
1031
|
+
TABLE_NAME: 'film_category',
|
|
1032
|
+
FILM_ID: 'film_category.film_id',
|
|
1033
|
+
CATEGORY_ID: 'film_category.category_id',
|
|
1034
|
+
LAST_UPDATE: 'film_category.last_update',
|
|
1035
|
+
PRIMARY: [
|
|
1036
|
+
'film_category.film_id',
|
|
1037
|
+
'film_category.category_id',
|
|
1038
|
+
],
|
|
1039
|
+
PRIMARY_SHORT: [
|
|
1040
|
+
'film_id',
|
|
1041
|
+
'category_id',
|
|
1042
|
+
],
|
|
1043
|
+
COLUMNS: {
|
|
1044
|
+
'film_category.film_id': 'film_id',
|
|
1045
|
+
'film_category.category_id': 'category_id',
|
|
1046
|
+
'film_category.last_update': 'last_update',
|
|
1047
|
+
},
|
|
1048
|
+
TYPE_VALIDATION: {
|
|
1049
|
+
'film_category.film_id': {
|
|
1050
|
+
MYSQL_TYPE: 'smallint',
|
|
1051
|
+
MAX_LENGTH: '',
|
|
1052
|
+
AUTO_INCREMENT: false,
|
|
1053
|
+
SKIP_COLUMN_IN_POST: false
|
|
1054
|
+
},
|
|
1055
|
+
'film_category.category_id': {
|
|
1056
|
+
MYSQL_TYPE: 'tinyint',
|
|
1057
|
+
MAX_LENGTH: '',
|
|
1058
|
+
AUTO_INCREMENT: false,
|
|
1059
|
+
SKIP_COLUMN_IN_POST: false
|
|
1060
|
+
},
|
|
1061
|
+
'film_category.last_update': {
|
|
1062
|
+
MYSQL_TYPE: 'timestamp',
|
|
1063
|
+
MAX_LENGTH: '',
|
|
1064
|
+
AUTO_INCREMENT: false,
|
|
1065
|
+
SKIP_COLUMN_IN_POST: false
|
|
1066
|
+
},
|
|
1067
|
+
},
|
|
1068
|
+
REGEX_VALIDATION: {
|
|
1069
|
+
},
|
|
1070
|
+
LIFECYCLE_HOOKS: {
|
|
1071
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1072
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1073
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1074
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1075
|
+
},
|
|
1076
|
+
TABLE_REFERENCES: {
|
|
1077
|
+
'category_id': [{
|
|
1078
|
+
TABLE: 'category',
|
|
1079
|
+
COLUMN: 'category_id',
|
|
1080
|
+
CONSTRAINT: 'fk_film_category_category',
|
|
1081
|
+
},],'film_id': [{
|
|
1082
|
+
TABLE: 'film',
|
|
1083
|
+
COLUMN: 'film_id',
|
|
1084
|
+
CONSTRAINT: 'fk_film_category_film',
|
|
1085
|
+
},],
|
|
1086
|
+
},
|
|
1087
|
+
TABLE_REFERENCED_BY: {
|
|
1088
|
+
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
CREATE TABLE `film_text` (
|
|
1094
|
+
`film_id` smallint unsigned NOT NULL,
|
|
1095
|
+
`title` varchar(255) NOT NULL,
|
|
1096
|
+
`description` text,
|
|
1097
|
+
PRIMARY KEY (`film_id`),
|
|
1098
|
+
FULLTEXT KEY `idx_title_description` (`title`,`description`)
|
|
1099
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1100
|
+
**/
|
|
1101
|
+
|
|
1102
|
+
export interface iFilm_Text {
|
|
1103
|
+
'film_id'?: number;
|
|
1104
|
+
'title'?: string;
|
|
1105
|
+
'description'?: string | null;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
export type Film_TextPrimaryKeys =
|
|
1109
|
+
'film_id'
|
|
1110
|
+
;
|
|
1111
|
+
|
|
1112
|
+
const film_text:
|
|
1113
|
+
C6RestfulModel<
|
|
1114
|
+
'film_text',
|
|
1115
|
+
iFilm_Text,
|
|
1116
|
+
Film_TextPrimaryKeys
|
|
1117
|
+
> = {
|
|
1118
|
+
TABLE_NAME: 'film_text',
|
|
1119
|
+
FILM_ID: 'film_text.film_id',
|
|
1120
|
+
TITLE: 'film_text.title',
|
|
1121
|
+
DESCRIPTION: 'film_text.description',
|
|
1122
|
+
PRIMARY: [
|
|
1123
|
+
'film_text.film_id',
|
|
1124
|
+
],
|
|
1125
|
+
PRIMARY_SHORT: [
|
|
1126
|
+
'film_id',
|
|
1127
|
+
],
|
|
1128
|
+
COLUMNS: {
|
|
1129
|
+
'film_text.film_id': 'film_id',
|
|
1130
|
+
'film_text.title': 'title',
|
|
1131
|
+
'film_text.description': 'description',
|
|
1132
|
+
},
|
|
1133
|
+
TYPE_VALIDATION: {
|
|
1134
|
+
'film_text.film_id': {
|
|
1135
|
+
MYSQL_TYPE: 'smallint',
|
|
1136
|
+
MAX_LENGTH: '',
|
|
1137
|
+
AUTO_INCREMENT: false,
|
|
1138
|
+
SKIP_COLUMN_IN_POST: false
|
|
1139
|
+
},
|
|
1140
|
+
'film_text.title': {
|
|
1141
|
+
MYSQL_TYPE: 'varchar',
|
|
1142
|
+
MAX_LENGTH: '255',
|
|
1143
|
+
AUTO_INCREMENT: false,
|
|
1144
|
+
SKIP_COLUMN_IN_POST: false
|
|
1145
|
+
},
|
|
1146
|
+
'film_text.description': {
|
|
1147
|
+
MYSQL_TYPE: 'text',
|
|
1148
|
+
MAX_LENGTH: '',
|
|
1149
|
+
AUTO_INCREMENT: false,
|
|
1150
|
+
SKIP_COLUMN_IN_POST: true
|
|
1151
|
+
},
|
|
1152
|
+
},
|
|
1153
|
+
REGEX_VALIDATION: {
|
|
1154
|
+
},
|
|
1155
|
+
LIFECYCLE_HOOKS: {
|
|
1156
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1157
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1158
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1159
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1160
|
+
},
|
|
1161
|
+
TABLE_REFERENCES: {
|
|
1162
|
+
|
|
1163
|
+
},
|
|
1164
|
+
TABLE_REFERENCED_BY: {
|
|
1165
|
+
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
CREATE TABLE `inventory` (
|
|
1171
|
+
`inventory_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
|
|
1172
|
+
`film_id` smallint unsigned NOT NULL,
|
|
1173
|
+
`store_id` tinyint unsigned NOT NULL,
|
|
1174
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1175
|
+
PRIMARY KEY (`inventory_id`),
|
|
1176
|
+
KEY `idx_fk_film_id` (`film_id`),
|
|
1177
|
+
KEY `idx_store_id_film_id` (`store_id`,`film_id`),
|
|
1178
|
+
CONSTRAINT `fk_inventory_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1179
|
+
CONSTRAINT `fk_inventory_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1180
|
+
) ENGINE=InnoDB AUTO_INCREMENT=4582 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1181
|
+
**/
|
|
1182
|
+
|
|
1183
|
+
export interface iInventory {
|
|
1184
|
+
'inventory_id'?: number;
|
|
1185
|
+
'film_id'?: number;
|
|
1186
|
+
'store_id'?: number;
|
|
1187
|
+
'last_update'?: Date | number | string;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export type InventoryPrimaryKeys =
|
|
1191
|
+
'inventory_id'
|
|
1192
|
+
;
|
|
1193
|
+
|
|
1194
|
+
const inventory:
|
|
1195
|
+
C6RestfulModel<
|
|
1196
|
+
'inventory',
|
|
1197
|
+
iInventory,
|
|
1198
|
+
InventoryPrimaryKeys
|
|
1199
|
+
> = {
|
|
1200
|
+
TABLE_NAME: 'inventory',
|
|
1201
|
+
INVENTORY_ID: 'inventory.inventory_id',
|
|
1202
|
+
FILM_ID: 'inventory.film_id',
|
|
1203
|
+
STORE_ID: 'inventory.store_id',
|
|
1204
|
+
LAST_UPDATE: 'inventory.last_update',
|
|
1205
|
+
PRIMARY: [
|
|
1206
|
+
'inventory.inventory_id',
|
|
1207
|
+
],
|
|
1208
|
+
PRIMARY_SHORT: [
|
|
1209
|
+
'inventory_id',
|
|
1210
|
+
],
|
|
1211
|
+
COLUMNS: {
|
|
1212
|
+
'inventory.inventory_id': 'inventory_id',
|
|
1213
|
+
'inventory.film_id': 'film_id',
|
|
1214
|
+
'inventory.store_id': 'store_id',
|
|
1215
|
+
'inventory.last_update': 'last_update',
|
|
1216
|
+
},
|
|
1217
|
+
TYPE_VALIDATION: {
|
|
1218
|
+
'inventory.inventory_id': {
|
|
1219
|
+
MYSQL_TYPE: 'mediumint',
|
|
1220
|
+
MAX_LENGTH: '',
|
|
1221
|
+
AUTO_INCREMENT: true,
|
|
1222
|
+
SKIP_COLUMN_IN_POST: false
|
|
1223
|
+
},
|
|
1224
|
+
'inventory.film_id': {
|
|
1225
|
+
MYSQL_TYPE: 'smallint',
|
|
1226
|
+
MAX_LENGTH: '',
|
|
1227
|
+
AUTO_INCREMENT: false,
|
|
1228
|
+
SKIP_COLUMN_IN_POST: false
|
|
1229
|
+
},
|
|
1230
|
+
'inventory.store_id': {
|
|
1231
|
+
MYSQL_TYPE: 'tinyint',
|
|
1232
|
+
MAX_LENGTH: '',
|
|
1233
|
+
AUTO_INCREMENT: false,
|
|
1234
|
+
SKIP_COLUMN_IN_POST: false
|
|
1235
|
+
},
|
|
1236
|
+
'inventory.last_update': {
|
|
1237
|
+
MYSQL_TYPE: 'timestamp',
|
|
1238
|
+
MAX_LENGTH: '',
|
|
1239
|
+
AUTO_INCREMENT: false,
|
|
1240
|
+
SKIP_COLUMN_IN_POST: false
|
|
1241
|
+
},
|
|
1242
|
+
},
|
|
1243
|
+
REGEX_VALIDATION: {
|
|
1244
|
+
},
|
|
1245
|
+
LIFECYCLE_HOOKS: {
|
|
1246
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1247
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1248
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1249
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1250
|
+
},
|
|
1251
|
+
TABLE_REFERENCES: {
|
|
1252
|
+
'film_id': [{
|
|
1253
|
+
TABLE: 'film',
|
|
1254
|
+
COLUMN: 'film_id',
|
|
1255
|
+
CONSTRAINT: 'fk_inventory_film',
|
|
1256
|
+
},],'store_id': [{
|
|
1257
|
+
TABLE: 'store',
|
|
1258
|
+
COLUMN: 'store_id',
|
|
1259
|
+
CONSTRAINT: 'fk_inventory_store',
|
|
1260
|
+
},],
|
|
1261
|
+
},
|
|
1262
|
+
TABLE_REFERENCED_BY: {
|
|
1263
|
+
'inventory_id': [{
|
|
1264
|
+
TABLE: 'rental',
|
|
1265
|
+
COLUMN: 'inventory_id',
|
|
1266
|
+
CONSTRAINT: 'fk_rental_inventory',
|
|
1267
|
+
},],
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
/**
|
|
1272
|
+
CREATE TABLE `language` (
|
|
1273
|
+
`language_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
|
1274
|
+
`name` char(20) NOT NULL,
|
|
1275
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1276
|
+
PRIMARY KEY (`language_id`)
|
|
1277
|
+
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1278
|
+
**/
|
|
1279
|
+
|
|
1280
|
+
export interface iLanguage {
|
|
1281
|
+
'language_id'?: number;
|
|
1282
|
+
'name'?: string;
|
|
1283
|
+
'last_update'?: Date | number | string;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
export type LanguagePrimaryKeys =
|
|
1287
|
+
'language_id'
|
|
1288
|
+
;
|
|
1289
|
+
|
|
1290
|
+
const language:
|
|
1291
|
+
C6RestfulModel<
|
|
1292
|
+
'language',
|
|
1293
|
+
iLanguage,
|
|
1294
|
+
LanguagePrimaryKeys
|
|
1295
|
+
> = {
|
|
1296
|
+
TABLE_NAME: 'language',
|
|
1297
|
+
LANGUAGE_ID: 'language.language_id',
|
|
1298
|
+
NAME: 'language.name',
|
|
1299
|
+
LAST_UPDATE: 'language.last_update',
|
|
1300
|
+
PRIMARY: [
|
|
1301
|
+
'language.language_id',
|
|
1302
|
+
],
|
|
1303
|
+
PRIMARY_SHORT: [
|
|
1304
|
+
'language_id',
|
|
1305
|
+
],
|
|
1306
|
+
COLUMNS: {
|
|
1307
|
+
'language.language_id': 'language_id',
|
|
1308
|
+
'language.name': 'name',
|
|
1309
|
+
'language.last_update': 'last_update',
|
|
1310
|
+
},
|
|
1311
|
+
TYPE_VALIDATION: {
|
|
1312
|
+
'language.language_id': {
|
|
1313
|
+
MYSQL_TYPE: 'tinyint',
|
|
1314
|
+
MAX_LENGTH: '',
|
|
1315
|
+
AUTO_INCREMENT: true,
|
|
1316
|
+
SKIP_COLUMN_IN_POST: false
|
|
1317
|
+
},
|
|
1318
|
+
'language.name': {
|
|
1319
|
+
MYSQL_TYPE: 'char',
|
|
1320
|
+
MAX_LENGTH: '20',
|
|
1321
|
+
AUTO_INCREMENT: false,
|
|
1322
|
+
SKIP_COLUMN_IN_POST: false
|
|
1323
|
+
},
|
|
1324
|
+
'language.last_update': {
|
|
1325
|
+
MYSQL_TYPE: 'timestamp',
|
|
1326
|
+
MAX_LENGTH: '',
|
|
1327
|
+
AUTO_INCREMENT: false,
|
|
1328
|
+
SKIP_COLUMN_IN_POST: false
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
REGEX_VALIDATION: {
|
|
1332
|
+
},
|
|
1333
|
+
LIFECYCLE_HOOKS: {
|
|
1334
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1335
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1336
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1337
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1338
|
+
},
|
|
1339
|
+
TABLE_REFERENCES: {
|
|
1340
|
+
|
|
1341
|
+
},
|
|
1342
|
+
TABLE_REFERENCED_BY: {
|
|
1343
|
+
'language_id': [{
|
|
1344
|
+
TABLE: 'film',
|
|
1345
|
+
COLUMN: 'language_id',
|
|
1346
|
+
CONSTRAINT: 'fk_film_language',
|
|
1347
|
+
},{
|
|
1348
|
+
TABLE: 'film',
|
|
1349
|
+
COLUMN: 'original_language_id',
|
|
1350
|
+
CONSTRAINT: 'fk_film_language_original',
|
|
1351
|
+
},],
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
CREATE TABLE `payment` (
|
|
1357
|
+
`payment_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
|
1358
|
+
`customer_id` smallint unsigned NOT NULL,
|
|
1359
|
+
`staff_id` tinyint unsigned NOT NULL,
|
|
1360
|
+
`rental_id` int DEFAULT NULL,
|
|
1361
|
+
`amount` decimal(5,2) NOT NULL,
|
|
1362
|
+
`payment_date` datetime NOT NULL,
|
|
1363
|
+
`last_update` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1364
|
+
PRIMARY KEY (`payment_id`),
|
|
1365
|
+
KEY `idx_fk_staff_id` (`staff_id`),
|
|
1366
|
+
KEY `idx_fk_customer_id` (`customer_id`),
|
|
1367
|
+
KEY `fk_payment_rental` (`rental_id`),
|
|
1368
|
+
CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1369
|
+
CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
|
1370
|
+
CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1371
|
+
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1372
|
+
**/
|
|
1373
|
+
|
|
1374
|
+
export interface iPayment {
|
|
1375
|
+
'payment_id'?: number;
|
|
1376
|
+
'customer_id'?: number;
|
|
1377
|
+
'staff_id'?: number;
|
|
1378
|
+
'rental_id'?: number | null;
|
|
1379
|
+
'amount'?: number;
|
|
1380
|
+
'payment_date'?: Date | number | string;
|
|
1381
|
+
'last_update'?: Date | number | string | null;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
export type PaymentPrimaryKeys =
|
|
1385
|
+
'payment_id'
|
|
1386
|
+
;
|
|
1387
|
+
|
|
1388
|
+
const payment:
|
|
1389
|
+
C6RestfulModel<
|
|
1390
|
+
'payment',
|
|
1391
|
+
iPayment,
|
|
1392
|
+
PaymentPrimaryKeys
|
|
1393
|
+
> = {
|
|
1394
|
+
TABLE_NAME: 'payment',
|
|
1395
|
+
PAYMENT_ID: 'payment.payment_id',
|
|
1396
|
+
CUSTOMER_ID: 'payment.customer_id',
|
|
1397
|
+
STAFF_ID: 'payment.staff_id',
|
|
1398
|
+
RENTAL_ID: 'payment.rental_id',
|
|
1399
|
+
AMOUNT: 'payment.amount',
|
|
1400
|
+
PAYMENT_DATE: 'payment.payment_date',
|
|
1401
|
+
LAST_UPDATE: 'payment.last_update',
|
|
1402
|
+
PRIMARY: [
|
|
1403
|
+
'payment.payment_id',
|
|
1404
|
+
],
|
|
1405
|
+
PRIMARY_SHORT: [
|
|
1406
|
+
'payment_id',
|
|
1407
|
+
],
|
|
1408
|
+
COLUMNS: {
|
|
1409
|
+
'payment.payment_id': 'payment_id',
|
|
1410
|
+
'payment.customer_id': 'customer_id',
|
|
1411
|
+
'payment.staff_id': 'staff_id',
|
|
1412
|
+
'payment.rental_id': 'rental_id',
|
|
1413
|
+
'payment.amount': 'amount',
|
|
1414
|
+
'payment.payment_date': 'payment_date',
|
|
1415
|
+
'payment.last_update': 'last_update',
|
|
1416
|
+
},
|
|
1417
|
+
TYPE_VALIDATION: {
|
|
1418
|
+
'payment.payment_id': {
|
|
1419
|
+
MYSQL_TYPE: 'smallint',
|
|
1420
|
+
MAX_LENGTH: '',
|
|
1421
|
+
AUTO_INCREMENT: true,
|
|
1422
|
+
SKIP_COLUMN_IN_POST: false
|
|
1423
|
+
},
|
|
1424
|
+
'payment.customer_id': {
|
|
1425
|
+
MYSQL_TYPE: 'smallint',
|
|
1426
|
+
MAX_LENGTH: '',
|
|
1427
|
+
AUTO_INCREMENT: false,
|
|
1428
|
+
SKIP_COLUMN_IN_POST: false
|
|
1429
|
+
},
|
|
1430
|
+
'payment.staff_id': {
|
|
1431
|
+
MYSQL_TYPE: 'tinyint',
|
|
1432
|
+
MAX_LENGTH: '',
|
|
1433
|
+
AUTO_INCREMENT: false,
|
|
1434
|
+
SKIP_COLUMN_IN_POST: false
|
|
1435
|
+
},
|
|
1436
|
+
'payment.rental_id': {
|
|
1437
|
+
MYSQL_TYPE: 'int',
|
|
1438
|
+
MAX_LENGTH: '',
|
|
1439
|
+
AUTO_INCREMENT: false,
|
|
1440
|
+
SKIP_COLUMN_IN_POST: false
|
|
1441
|
+
},
|
|
1442
|
+
'payment.amount': {
|
|
1443
|
+
MYSQL_TYPE: 'decimal',
|
|
1444
|
+
MAX_LENGTH: '5,2',
|
|
1445
|
+
AUTO_INCREMENT: false,
|
|
1446
|
+
SKIP_COLUMN_IN_POST: false
|
|
1447
|
+
},
|
|
1448
|
+
'payment.payment_date': {
|
|
1449
|
+
MYSQL_TYPE: 'datetime',
|
|
1450
|
+
MAX_LENGTH: '',
|
|
1451
|
+
AUTO_INCREMENT: false,
|
|
1452
|
+
SKIP_COLUMN_IN_POST: false
|
|
1453
|
+
},
|
|
1454
|
+
'payment.last_update': {
|
|
1455
|
+
MYSQL_TYPE: 'timestamp',
|
|
1456
|
+
MAX_LENGTH: '',
|
|
1457
|
+
AUTO_INCREMENT: false,
|
|
1458
|
+
SKIP_COLUMN_IN_POST: false
|
|
1459
|
+
},
|
|
1460
|
+
},
|
|
1461
|
+
REGEX_VALIDATION: {
|
|
1462
|
+
},
|
|
1463
|
+
LIFECYCLE_HOOKS: {
|
|
1464
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1465
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1466
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1467
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1468
|
+
},
|
|
1469
|
+
TABLE_REFERENCES: {
|
|
1470
|
+
'customer_id': [{
|
|
1471
|
+
TABLE: 'customer',
|
|
1472
|
+
COLUMN: 'customer_id',
|
|
1473
|
+
CONSTRAINT: 'fk_payment_customer',
|
|
1474
|
+
},],'rental_id': [{
|
|
1475
|
+
TABLE: 'rental',
|
|
1476
|
+
COLUMN: 'rental_id',
|
|
1477
|
+
CONSTRAINT: 'fk_payment_rental',
|
|
1478
|
+
},],'staff_id': [{
|
|
1479
|
+
TABLE: 'staff',
|
|
1480
|
+
COLUMN: 'staff_id',
|
|
1481
|
+
CONSTRAINT: 'fk_payment_staff',
|
|
1482
|
+
},],
|
|
1483
|
+
},
|
|
1484
|
+
TABLE_REFERENCED_BY: {
|
|
1485
|
+
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
CREATE TABLE `rental` (
|
|
1491
|
+
`rental_id` int NOT NULL AUTO_INCREMENT,
|
|
1492
|
+
`rental_date` datetime NOT NULL,
|
|
1493
|
+
`inventory_id` mediumint unsigned NOT NULL,
|
|
1494
|
+
`customer_id` smallint unsigned NOT NULL,
|
|
1495
|
+
`return_date` datetime DEFAULT NULL,
|
|
1496
|
+
`staff_id` tinyint unsigned NOT NULL,
|
|
1497
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1498
|
+
PRIMARY KEY (`rental_id`),
|
|
1499
|
+
UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
|
|
1500
|
+
KEY `idx_fk_inventory_id` (`inventory_id`),
|
|
1501
|
+
KEY `idx_fk_customer_id` (`customer_id`),
|
|
1502
|
+
KEY `idx_fk_staff_id` (`staff_id`),
|
|
1503
|
+
CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1504
|
+
CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1505
|
+
CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1506
|
+
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1507
|
+
**/
|
|
1508
|
+
|
|
1509
|
+
export interface iRental {
|
|
1510
|
+
'rental_id'?: number;
|
|
1511
|
+
'rental_date'?: Date | number | string;
|
|
1512
|
+
'inventory_id'?: number;
|
|
1513
|
+
'customer_id'?: number;
|
|
1514
|
+
'return_date'?: Date | number | string | null;
|
|
1515
|
+
'staff_id'?: number;
|
|
1516
|
+
'last_update'?: Date | number | string;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
export type RentalPrimaryKeys =
|
|
1520
|
+
'rental_id'
|
|
1521
|
+
;
|
|
1522
|
+
|
|
1523
|
+
const rental:
|
|
1524
|
+
C6RestfulModel<
|
|
1525
|
+
'rental',
|
|
1526
|
+
iRental,
|
|
1527
|
+
RentalPrimaryKeys
|
|
1528
|
+
> = {
|
|
1529
|
+
TABLE_NAME: 'rental',
|
|
1530
|
+
RENTAL_ID: 'rental.rental_id',
|
|
1531
|
+
RENTAL_DATE: 'rental.rental_date',
|
|
1532
|
+
INVENTORY_ID: 'rental.inventory_id',
|
|
1533
|
+
CUSTOMER_ID: 'rental.customer_id',
|
|
1534
|
+
RETURN_DATE: 'rental.return_date',
|
|
1535
|
+
STAFF_ID: 'rental.staff_id',
|
|
1536
|
+
LAST_UPDATE: 'rental.last_update',
|
|
1537
|
+
PRIMARY: [
|
|
1538
|
+
'rental.rental_id',
|
|
1539
|
+
],
|
|
1540
|
+
PRIMARY_SHORT: [
|
|
1541
|
+
'rental_id',
|
|
1542
|
+
],
|
|
1543
|
+
COLUMNS: {
|
|
1544
|
+
'rental.rental_id': 'rental_id',
|
|
1545
|
+
'rental.rental_date': 'rental_date',
|
|
1546
|
+
'rental.inventory_id': 'inventory_id',
|
|
1547
|
+
'rental.customer_id': 'customer_id',
|
|
1548
|
+
'rental.return_date': 'return_date',
|
|
1549
|
+
'rental.staff_id': 'staff_id',
|
|
1550
|
+
'rental.last_update': 'last_update',
|
|
1551
|
+
},
|
|
1552
|
+
TYPE_VALIDATION: {
|
|
1553
|
+
'rental.rental_id': {
|
|
1554
|
+
MYSQL_TYPE: 'int',
|
|
1555
|
+
MAX_LENGTH: '',
|
|
1556
|
+
AUTO_INCREMENT: true,
|
|
1557
|
+
SKIP_COLUMN_IN_POST: false
|
|
1558
|
+
},
|
|
1559
|
+
'rental.rental_date': {
|
|
1560
|
+
MYSQL_TYPE: 'datetime',
|
|
1561
|
+
MAX_LENGTH: '',
|
|
1562
|
+
AUTO_INCREMENT: false,
|
|
1563
|
+
SKIP_COLUMN_IN_POST: false
|
|
1564
|
+
},
|
|
1565
|
+
'rental.inventory_id': {
|
|
1566
|
+
MYSQL_TYPE: 'mediumint',
|
|
1567
|
+
MAX_LENGTH: '',
|
|
1568
|
+
AUTO_INCREMENT: false,
|
|
1569
|
+
SKIP_COLUMN_IN_POST: false
|
|
1570
|
+
},
|
|
1571
|
+
'rental.customer_id': {
|
|
1572
|
+
MYSQL_TYPE: 'smallint',
|
|
1573
|
+
MAX_LENGTH: '',
|
|
1574
|
+
AUTO_INCREMENT: false,
|
|
1575
|
+
SKIP_COLUMN_IN_POST: false
|
|
1576
|
+
},
|
|
1577
|
+
'rental.return_date': {
|
|
1578
|
+
MYSQL_TYPE: 'datetime',
|
|
1579
|
+
MAX_LENGTH: '',
|
|
1580
|
+
AUTO_INCREMENT: false,
|
|
1581
|
+
SKIP_COLUMN_IN_POST: false
|
|
1582
|
+
},
|
|
1583
|
+
'rental.staff_id': {
|
|
1584
|
+
MYSQL_TYPE: 'tinyint',
|
|
1585
|
+
MAX_LENGTH: '',
|
|
1586
|
+
AUTO_INCREMENT: false,
|
|
1587
|
+
SKIP_COLUMN_IN_POST: false
|
|
1588
|
+
},
|
|
1589
|
+
'rental.last_update': {
|
|
1590
|
+
MYSQL_TYPE: 'timestamp',
|
|
1591
|
+
MAX_LENGTH: '',
|
|
1592
|
+
AUTO_INCREMENT: false,
|
|
1593
|
+
SKIP_COLUMN_IN_POST: false
|
|
1594
|
+
},
|
|
1595
|
+
},
|
|
1596
|
+
REGEX_VALIDATION: {
|
|
1597
|
+
},
|
|
1598
|
+
LIFECYCLE_HOOKS: {
|
|
1599
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1600
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1601
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1602
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1603
|
+
},
|
|
1604
|
+
TABLE_REFERENCES: {
|
|
1605
|
+
'customer_id': [{
|
|
1606
|
+
TABLE: 'customer',
|
|
1607
|
+
COLUMN: 'customer_id',
|
|
1608
|
+
CONSTRAINT: 'fk_rental_customer',
|
|
1609
|
+
},],'inventory_id': [{
|
|
1610
|
+
TABLE: 'inventory',
|
|
1611
|
+
COLUMN: 'inventory_id',
|
|
1612
|
+
CONSTRAINT: 'fk_rental_inventory',
|
|
1613
|
+
},],'staff_id': [{
|
|
1614
|
+
TABLE: 'staff',
|
|
1615
|
+
COLUMN: 'staff_id',
|
|
1616
|
+
CONSTRAINT: 'fk_rental_staff',
|
|
1617
|
+
},],
|
|
1618
|
+
},
|
|
1619
|
+
TABLE_REFERENCED_BY: {
|
|
1620
|
+
'rental_id': [{
|
|
1621
|
+
TABLE: 'payment',
|
|
1622
|
+
COLUMN: 'rental_id',
|
|
1623
|
+
CONSTRAINT: 'fk_payment_rental',
|
|
1624
|
+
},],
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
CREATE TABLE `staff` (
|
|
1630
|
+
`staff_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
|
1631
|
+
`first_name` varchar(45) NOT NULL,
|
|
1632
|
+
`last_name` varchar(45) NOT NULL,
|
|
1633
|
+
`address_id` smallint unsigned NOT NULL,
|
|
1634
|
+
`picture` blob,
|
|
1635
|
+
`email` varchar(50) DEFAULT NULL,
|
|
1636
|
+
`store_id` tinyint unsigned NOT NULL,
|
|
1637
|
+
`active` tinyint(1) NOT NULL DEFAULT '1',
|
|
1638
|
+
`username` varchar(16) NOT NULL,
|
|
1639
|
+
`password` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
|
1640
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1641
|
+
PRIMARY KEY (`staff_id`),
|
|
1642
|
+
KEY `idx_fk_store_id` (`store_id`),
|
|
1643
|
+
KEY `idx_fk_address_id` (`address_id`),
|
|
1644
|
+
CONSTRAINT `fk_staff_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1645
|
+
CONSTRAINT `fk_staff_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1646
|
+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1647
|
+
**/
|
|
1648
|
+
|
|
1649
|
+
export interface iStaff {
|
|
1650
|
+
'staff_id'?: number;
|
|
1651
|
+
'first_name'?: string;
|
|
1652
|
+
'last_name'?: string;
|
|
1653
|
+
'address_id'?: number;
|
|
1654
|
+
'picture'?: Buffer | string | null;
|
|
1655
|
+
'email'?: string | null;
|
|
1656
|
+
'store_id'?: number;
|
|
1657
|
+
'active'?: number;
|
|
1658
|
+
'username'?: string;
|
|
1659
|
+
'password'?: string | null;
|
|
1660
|
+
'last_update'?: Date | number | string;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
export type StaffPrimaryKeys =
|
|
1664
|
+
'staff_id'
|
|
1665
|
+
;
|
|
1666
|
+
|
|
1667
|
+
const staff:
|
|
1668
|
+
C6RestfulModel<
|
|
1669
|
+
'staff',
|
|
1670
|
+
iStaff,
|
|
1671
|
+
StaffPrimaryKeys
|
|
1672
|
+
> = {
|
|
1673
|
+
TABLE_NAME: 'staff',
|
|
1674
|
+
STAFF_ID: 'staff.staff_id',
|
|
1675
|
+
FIRST_NAME: 'staff.first_name',
|
|
1676
|
+
LAST_NAME: 'staff.last_name',
|
|
1677
|
+
ADDRESS_ID: 'staff.address_id',
|
|
1678
|
+
PICTURE: 'staff.picture',
|
|
1679
|
+
EMAIL: 'staff.email',
|
|
1680
|
+
STORE_ID: 'staff.store_id',
|
|
1681
|
+
ACTIVE: 'staff.active',
|
|
1682
|
+
USERNAME: 'staff.username',
|
|
1683
|
+
PASSWORD: 'staff.password',
|
|
1684
|
+
LAST_UPDATE: 'staff.last_update',
|
|
1685
|
+
PRIMARY: [
|
|
1686
|
+
'staff.staff_id',
|
|
1687
|
+
],
|
|
1688
|
+
PRIMARY_SHORT: [
|
|
1689
|
+
'staff_id',
|
|
1690
|
+
],
|
|
1691
|
+
COLUMNS: {
|
|
1692
|
+
'staff.staff_id': 'staff_id',
|
|
1693
|
+
'staff.first_name': 'first_name',
|
|
1694
|
+
'staff.last_name': 'last_name',
|
|
1695
|
+
'staff.address_id': 'address_id',
|
|
1696
|
+
'staff.picture': 'picture',
|
|
1697
|
+
'staff.email': 'email',
|
|
1698
|
+
'staff.store_id': 'store_id',
|
|
1699
|
+
'staff.active': 'active',
|
|
1700
|
+
'staff.username': 'username',
|
|
1701
|
+
'staff.password': 'password',
|
|
1702
|
+
'staff.last_update': 'last_update',
|
|
1703
|
+
},
|
|
1704
|
+
TYPE_VALIDATION: {
|
|
1705
|
+
'staff.staff_id': {
|
|
1706
|
+
MYSQL_TYPE: 'tinyint',
|
|
1707
|
+
MAX_LENGTH: '',
|
|
1708
|
+
AUTO_INCREMENT: true,
|
|
1709
|
+
SKIP_COLUMN_IN_POST: false
|
|
1710
|
+
},
|
|
1711
|
+
'staff.first_name': {
|
|
1712
|
+
MYSQL_TYPE: 'varchar',
|
|
1713
|
+
MAX_LENGTH: '45',
|
|
1714
|
+
AUTO_INCREMENT: false,
|
|
1715
|
+
SKIP_COLUMN_IN_POST: false
|
|
1716
|
+
},
|
|
1717
|
+
'staff.last_name': {
|
|
1718
|
+
MYSQL_TYPE: 'varchar',
|
|
1719
|
+
MAX_LENGTH: '45',
|
|
1720
|
+
AUTO_INCREMENT: false,
|
|
1721
|
+
SKIP_COLUMN_IN_POST: false
|
|
1722
|
+
},
|
|
1723
|
+
'staff.address_id': {
|
|
1724
|
+
MYSQL_TYPE: 'smallint',
|
|
1725
|
+
MAX_LENGTH: '',
|
|
1726
|
+
AUTO_INCREMENT: false,
|
|
1727
|
+
SKIP_COLUMN_IN_POST: false
|
|
1728
|
+
},
|
|
1729
|
+
'staff.picture': {
|
|
1730
|
+
MYSQL_TYPE: 'blob',
|
|
1731
|
+
MAX_LENGTH: '',
|
|
1732
|
+
AUTO_INCREMENT: false,
|
|
1733
|
+
SKIP_COLUMN_IN_POST: true
|
|
1734
|
+
},
|
|
1735
|
+
'staff.email': {
|
|
1736
|
+
MYSQL_TYPE: 'varchar',
|
|
1737
|
+
MAX_LENGTH: '50',
|
|
1738
|
+
AUTO_INCREMENT: false,
|
|
1739
|
+
SKIP_COLUMN_IN_POST: false
|
|
1740
|
+
},
|
|
1741
|
+
'staff.store_id': {
|
|
1742
|
+
MYSQL_TYPE: 'tinyint',
|
|
1743
|
+
MAX_LENGTH: '',
|
|
1744
|
+
AUTO_INCREMENT: false,
|
|
1745
|
+
SKIP_COLUMN_IN_POST: false
|
|
1746
|
+
},
|
|
1747
|
+
'staff.active': {
|
|
1748
|
+
MYSQL_TYPE: 'tinyint',
|
|
1749
|
+
MAX_LENGTH: '1',
|
|
1750
|
+
AUTO_INCREMENT: false,
|
|
1751
|
+
SKIP_COLUMN_IN_POST: false
|
|
1752
|
+
},
|
|
1753
|
+
'staff.username': {
|
|
1754
|
+
MYSQL_TYPE: 'varchar',
|
|
1755
|
+
MAX_LENGTH: '16',
|
|
1756
|
+
AUTO_INCREMENT: false,
|
|
1757
|
+
SKIP_COLUMN_IN_POST: false
|
|
1758
|
+
},
|
|
1759
|
+
'staff.password': {
|
|
1760
|
+
MYSQL_TYPE: 'varchar',
|
|
1761
|
+
MAX_LENGTH: '40',
|
|
1762
|
+
AUTO_INCREMENT: false,
|
|
1763
|
+
SKIP_COLUMN_IN_POST: true
|
|
1764
|
+
},
|
|
1765
|
+
'staff.last_update': {
|
|
1766
|
+
MYSQL_TYPE: 'timestamp',
|
|
1767
|
+
MAX_LENGTH: '',
|
|
1768
|
+
AUTO_INCREMENT: false,
|
|
1769
|
+
SKIP_COLUMN_IN_POST: false
|
|
1770
|
+
},
|
|
1771
|
+
},
|
|
1772
|
+
REGEX_VALIDATION: {
|
|
1773
|
+
},
|
|
1774
|
+
LIFECYCLE_HOOKS: {
|
|
1775
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1776
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1777
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1778
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1779
|
+
},
|
|
1780
|
+
TABLE_REFERENCES: {
|
|
1781
|
+
'address_id': [{
|
|
1782
|
+
TABLE: 'address',
|
|
1783
|
+
COLUMN: 'address_id',
|
|
1784
|
+
CONSTRAINT: 'fk_staff_address',
|
|
1785
|
+
},],'store_id': [{
|
|
1786
|
+
TABLE: 'store',
|
|
1787
|
+
COLUMN: 'store_id',
|
|
1788
|
+
CONSTRAINT: 'fk_staff_store',
|
|
1789
|
+
},],
|
|
1790
|
+
},
|
|
1791
|
+
TABLE_REFERENCED_BY: {
|
|
1792
|
+
'staff_id': [{
|
|
1793
|
+
TABLE: 'payment',
|
|
1794
|
+
COLUMN: 'staff_id',
|
|
1795
|
+
CONSTRAINT: 'fk_payment_staff',
|
|
1796
|
+
},{
|
|
1797
|
+
TABLE: 'rental',
|
|
1798
|
+
COLUMN: 'staff_id',
|
|
1799
|
+
CONSTRAINT: 'fk_rental_staff',
|
|
1800
|
+
},{
|
|
1801
|
+
TABLE: 'store',
|
|
1802
|
+
COLUMN: 'manager_staff_id',
|
|
1803
|
+
CONSTRAINT: 'fk_store_staff',
|
|
1804
|
+
},],
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
CREATE TABLE `store` (
|
|
1810
|
+
`store_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
|
1811
|
+
`manager_staff_id` tinyint unsigned NOT NULL,
|
|
1812
|
+
`address_id` smallint unsigned NOT NULL,
|
|
1813
|
+
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
1814
|
+
PRIMARY KEY (`store_id`),
|
|
1815
|
+
UNIQUE KEY `idx_unique_manager` (`manager_staff_id`),
|
|
1816
|
+
KEY `idx_fk_address_id` (`address_id`),
|
|
1817
|
+
CONSTRAINT `fk_store_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
1818
|
+
CONSTRAINT `fk_store_staff` FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`staff_id`) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
1819
|
+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
|
1820
|
+
**/
|
|
1821
|
+
|
|
1822
|
+
export interface iStore {
|
|
1823
|
+
'store_id'?: number;
|
|
1824
|
+
'manager_staff_id'?: number;
|
|
1825
|
+
'address_id'?: number;
|
|
1826
|
+
'last_update'?: Date | number | string;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
export type StorePrimaryKeys =
|
|
1830
|
+
'store_id'
|
|
1831
|
+
;
|
|
1832
|
+
|
|
1833
|
+
const store:
|
|
1834
|
+
C6RestfulModel<
|
|
1835
|
+
'store',
|
|
1836
|
+
iStore,
|
|
1837
|
+
StorePrimaryKeys
|
|
1838
|
+
> = {
|
|
1839
|
+
TABLE_NAME: 'store',
|
|
1840
|
+
STORE_ID: 'store.store_id',
|
|
1841
|
+
MANAGER_STAFF_ID: 'store.manager_staff_id',
|
|
1842
|
+
ADDRESS_ID: 'store.address_id',
|
|
1843
|
+
LAST_UPDATE: 'store.last_update',
|
|
1844
|
+
PRIMARY: [
|
|
1845
|
+
'store.store_id',
|
|
1846
|
+
],
|
|
1847
|
+
PRIMARY_SHORT: [
|
|
1848
|
+
'store_id',
|
|
1849
|
+
],
|
|
1850
|
+
COLUMNS: {
|
|
1851
|
+
'store.store_id': 'store_id',
|
|
1852
|
+
'store.manager_staff_id': 'manager_staff_id',
|
|
1853
|
+
'store.address_id': 'address_id',
|
|
1854
|
+
'store.last_update': 'last_update',
|
|
1855
|
+
},
|
|
1856
|
+
TYPE_VALIDATION: {
|
|
1857
|
+
'store.store_id': {
|
|
1858
|
+
MYSQL_TYPE: 'tinyint',
|
|
1859
|
+
MAX_LENGTH: '',
|
|
1860
|
+
AUTO_INCREMENT: true,
|
|
1861
|
+
SKIP_COLUMN_IN_POST: false
|
|
1862
|
+
},
|
|
1863
|
+
'store.manager_staff_id': {
|
|
1864
|
+
MYSQL_TYPE: 'tinyint',
|
|
1865
|
+
MAX_LENGTH: '',
|
|
1866
|
+
AUTO_INCREMENT: false,
|
|
1867
|
+
SKIP_COLUMN_IN_POST: false
|
|
1868
|
+
},
|
|
1869
|
+
'store.address_id': {
|
|
1870
|
+
MYSQL_TYPE: 'smallint',
|
|
1871
|
+
MAX_LENGTH: '',
|
|
1872
|
+
AUTO_INCREMENT: false,
|
|
1873
|
+
SKIP_COLUMN_IN_POST: false
|
|
1874
|
+
},
|
|
1875
|
+
'store.last_update': {
|
|
1876
|
+
MYSQL_TYPE: 'timestamp',
|
|
1877
|
+
MAX_LENGTH: '',
|
|
1878
|
+
AUTO_INCREMENT: false,
|
|
1879
|
+
SKIP_COLUMN_IN_POST: false
|
|
1880
|
+
},
|
|
1881
|
+
},
|
|
1882
|
+
REGEX_VALIDATION: {
|
|
1883
|
+
},
|
|
1884
|
+
LIFECYCLE_HOOKS: {
|
|
1885
|
+
GET: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1886
|
+
PUT: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1887
|
+
POST: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1888
|
+
DELETE: {beforeProcessing:{}, beforeExecution:{}, afterExecution:{}, afterCommit:{}},
|
|
1889
|
+
},
|
|
1890
|
+
TABLE_REFERENCES: {
|
|
1891
|
+
'address_id': [{
|
|
1892
|
+
TABLE: 'address',
|
|
1893
|
+
COLUMN: 'address_id',
|
|
1894
|
+
CONSTRAINT: 'fk_store_address',
|
|
1895
|
+
},],'manager_staff_id': [{
|
|
1896
|
+
TABLE: 'staff',
|
|
1897
|
+
COLUMN: 'staff_id',
|
|
1898
|
+
CONSTRAINT: 'fk_store_staff',
|
|
1899
|
+
},],
|
|
1900
|
+
},
|
|
1901
|
+
TABLE_REFERENCED_BY: {
|
|
1902
|
+
'store_id': [{
|
|
1903
|
+
TABLE: 'customer',
|
|
1904
|
+
COLUMN: 'store_id',
|
|
1905
|
+
CONSTRAINT: 'fk_customer_store',
|
|
1906
|
+
},{
|
|
1907
|
+
TABLE: 'inventory',
|
|
1908
|
+
COLUMN: 'store_id',
|
|
1909
|
+
CONSTRAINT: 'fk_inventory_store',
|
|
1910
|
+
},{
|
|
1911
|
+
TABLE: 'staff',
|
|
1912
|
+
COLUMN: 'store_id',
|
|
1913
|
+
CONSTRAINT: 'fk_staff_store',
|
|
1914
|
+
},],
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
export const TABLES = {
|
|
1919
|
+
actor,address,category,city,country,customer,film,film_actor,film_category,film_text,inventory,language,payment,rental,staff,store,
|
|
1920
|
+
} satisfies {
|
|
1921
|
+
[K in keyof RestTableInterfaces]: C6RestfulModel<K, RestTableInterfaces[K], keyof RestTableInterfaces[K] & string>;
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1924
|
+
export type RestTableInterfaces = iActor
|
|
1925
|
+
| iAddress
|
|
1926
|
+
| iCategory
|
|
1927
|
+
| iCity
|
|
1928
|
+
| iCountry
|
|
1929
|
+
| iCustomer
|
|
1930
|
+
| iFilm
|
|
1931
|
+
| iFilm_Actor
|
|
1932
|
+
| iFilm_Category
|
|
1933
|
+
| iFilm_Text
|
|
1934
|
+
| iInventory
|
|
1935
|
+
| iLanguage
|
|
1936
|
+
| iPayment
|
|
1937
|
+
| iRental
|
|
1938
|
+
| iStaff
|
|
1939
|
+
| iStore;
|
|
1940
|
+
|
|
1941
|
+
export const C6 : iC6Object<RestTableInterfaces> = {
|
|
1942
|
+
...C6Constants,
|
|
1943
|
+
C6VERSION: '3.7.7',
|
|
1944
|
+
IMPORT: async (tableName: string) : Promise<iDynamicApiImport> => {
|
|
1945
|
+
|
|
1946
|
+
tableName = tableName.toLowerCase();
|
|
1947
|
+
|
|
1948
|
+
// if tableName is not a key in the TABLES object then throw an error
|
|
1949
|
+
if (!TABLES[tableName as RestShortTableNames]) {
|
|
1950
|
+
const error = (table: string) => {
|
|
1951
|
+
throw Error('Table (' + table + ') does not exist in the TABLES object. Possible values include (' + Object.keys(TABLES).join(', ') + ')');
|
|
1952
|
+
}
|
|
1953
|
+
if (!tableName.startsWith(RestTablePrefix.toLowerCase())) {
|
|
1954
|
+
error(tableName);
|
|
1955
|
+
}
|
|
1956
|
+
tableName = removePrefixIfExists(tableName, RestTablePrefix);
|
|
1957
|
+
if (!TABLES[tableName as RestShortTableNames]) {
|
|
1958
|
+
error(tableName);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
// This will rightfully throw a dynamic import warning in the console, but it is necessary to use dynamic imports
|
|
1962
|
+
return import(/* @vite-ignore */ './' + (tableName.split('_')
|
|
1963
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
1964
|
+
.join('_')) + '.ts');
|
|
1965
|
+
|
|
1966
|
+
},
|
|
1967
|
+
PREFIX: RestTablePrefix,
|
|
1968
|
+
TABLES: TABLES,
|
|
1969
|
+
ORM: {},
|
|
1970
|
+
...TABLES
|
|
1971
|
+
};
|
|
1972
|
+
|
|
1973
|
+
export type tStatefulApiData<T> = T[] | undefined | null;
|
|
1974
|
+
|
|
1975
|
+
// this refers to the value types of the keys above, aka values in the state
|
|
1976
|
+
export interface iRestfulObjectArrayTypes {
|
|
1977
|
+
actor: tStatefulApiData<iActor>,
|
|
1978
|
+
address: tStatefulApiData<iAddress>,
|
|
1979
|
+
category: tStatefulApiData<iCategory>,
|
|
1980
|
+
city: tStatefulApiData<iCity>,
|
|
1981
|
+
country: tStatefulApiData<iCountry>,
|
|
1982
|
+
customer: tStatefulApiData<iCustomer>,
|
|
1983
|
+
film: tStatefulApiData<iFilm>,
|
|
1984
|
+
film_actor: tStatefulApiData<iFilm_Actor>,
|
|
1985
|
+
film_category: tStatefulApiData<iFilm_Category>,
|
|
1986
|
+
film_text: tStatefulApiData<iFilm_Text>,
|
|
1987
|
+
inventory: tStatefulApiData<iInventory>,
|
|
1988
|
+
language: tStatefulApiData<iLanguage>,
|
|
1989
|
+
payment: tStatefulApiData<iPayment>,
|
|
1990
|
+
rental: tStatefulApiData<iRental>,
|
|
1991
|
+
staff: tStatefulApiData<iStaff>,
|
|
1992
|
+
store: tStatefulApiData<iStore>,
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
export type tRestfulObjectArrayValues = iRestfulObjectArrayTypes[keyof iRestfulObjectArrayTypes];
|
|
1996
|
+
|
|
1997
|
+
export const initialRestfulObjectsState: iRestfulObjectArrayTypes = {
|
|
1998
|
+
actor: undefined,
|
|
1999
|
+
address: undefined,
|
|
2000
|
+
category: undefined,
|
|
2001
|
+
city: undefined,
|
|
2002
|
+
country: undefined,
|
|
2003
|
+
customer: undefined,
|
|
2004
|
+
film: undefined,
|
|
2005
|
+
film_actor: undefined,
|
|
2006
|
+
film_category: undefined,
|
|
2007
|
+
film_text: undefined,
|
|
2008
|
+
inventory: undefined,
|
|
2009
|
+
language: undefined,
|
|
2010
|
+
payment: undefined,
|
|
2011
|
+
rental: undefined,
|
|
2012
|
+
staff: undefined,
|
|
2013
|
+
store: undefined,
|
|
2014
|
+
};
|
|
2015
|
+
|
|
2016
|
+
export const COLUMNS = {
|
|
2017
|
+
'actor.actor_id': 'actor_id','actor.first_name': 'first_name','actor.last_name': 'last_name','actor.last_update': 'last_update',
|
|
2018
|
+
'address.address_id': 'address_id','address.address': 'address','address.address2': 'address2','address.district': 'district','address.city_id': 'city_id','address.postal_code': 'postal_code','address.phone': 'phone','address.location': 'location','address.last_update': 'last_update',
|
|
2019
|
+
'category.category_id': 'category_id','category.name': 'name','category.last_update': 'last_update',
|
|
2020
|
+
'city.city_id': 'city_id','city.city': 'city','city.country_id': 'country_id','city.last_update': 'last_update',
|
|
2021
|
+
'country.country_id': 'country_id','country.country': 'country','country.last_update': 'last_update',
|
|
2022
|
+
'customer.customer_id': 'customer_id','customer.store_id': 'store_id','customer.first_name': 'first_name','customer.last_name': 'last_name','customer.email': 'email','customer.address_id': 'address_id','customer.active': 'active','customer.create_date': 'create_date','customer.last_update': 'last_update',
|
|
2023
|
+
'film.film_id': 'film_id','film.title': 'title','film.description': 'description','film.release_year': 'release_year','film.language_id': 'language_id','film.original_language_id': 'original_language_id','film.rental_duration': 'rental_duration','film.rental_rate': 'rental_rate','film.length': 'length','film.replacement_cost': 'replacement_cost','film.rating': 'rating','film.special_features': 'special_features','film.last_update': 'last_update',
|
|
2024
|
+
'film_actor.actor_id': 'actor_id','film_actor.film_id': 'film_id','film_actor.last_update': 'last_update',
|
|
2025
|
+
'film_category.film_id': 'film_id','film_category.category_id': 'category_id','film_category.last_update': 'last_update',
|
|
2026
|
+
'film_text.film_id': 'film_id','film_text.title': 'title','film_text.description': 'description',
|
|
2027
|
+
'inventory.inventory_id': 'inventory_id','inventory.film_id': 'film_id','inventory.store_id': 'store_id','inventory.last_update': 'last_update',
|
|
2028
|
+
'language.language_id': 'language_id','language.name': 'name','language.last_update': 'last_update',
|
|
2029
|
+
'payment.payment_id': 'payment_id','payment.customer_id': 'customer_id','payment.staff_id': 'staff_id','payment.rental_id': 'rental_id','payment.amount': 'amount','payment.payment_date': 'payment_date','payment.last_update': 'last_update',
|
|
2030
|
+
'rental.rental_id': 'rental_id','rental.rental_date': 'rental_date','rental.inventory_id': 'inventory_id','rental.customer_id': 'customer_id','rental.return_date': 'return_date','rental.staff_id': 'staff_id','rental.last_update': 'last_update',
|
|
2031
|
+
'staff.staff_id': 'staff_id','staff.first_name': 'first_name','staff.last_name': 'last_name','staff.address_id': 'address_id','staff.picture': 'picture','staff.email': 'email','staff.store_id': 'store_id','staff.active': 'active','staff.username': 'username','staff.password': 'password','staff.last_update': 'last_update',
|
|
2032
|
+
'store.store_id': 'store_id','store.manager_staff_id': 'manager_staff_id','store.address_id': 'address_id','store.last_update': 'last_update',
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2035
|
+
export const GLOBAL_REST_PARAMETERS: Omit<iRest<
|
|
2036
|
+
RestShortTableNames,
|
|
2037
|
+
RestTableInterfaces>, "requestMethod" | "restModel"> = {
|
|
2038
|
+
C6: C6,
|
|
2039
|
+
restURL: "/rest/",
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
export const Actor = {
|
|
2043
|
+
...actor,
|
|
2044
|
+
...restOrm<
|
|
2045
|
+
OrmGenerics<any, 'actor', iActor, ActorPrimaryKeys>
|
|
2046
|
+
>(() => ({
|
|
2047
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2048
|
+
restModel: actor
|
|
2049
|
+
}))
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
export const Address = {
|
|
2053
|
+
...address,
|
|
2054
|
+
...restOrm<
|
|
2055
|
+
OrmGenerics<any, 'address', iAddress, AddressPrimaryKeys>
|
|
2056
|
+
>(() => ({
|
|
2057
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2058
|
+
restModel: address
|
|
2059
|
+
}))
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
export const Category = {
|
|
2063
|
+
...category,
|
|
2064
|
+
...restOrm<
|
|
2065
|
+
OrmGenerics<any, 'category', iCategory, CategoryPrimaryKeys>
|
|
2066
|
+
>(() => ({
|
|
2067
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2068
|
+
restModel: category
|
|
2069
|
+
}))
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
export const City = {
|
|
2073
|
+
...city,
|
|
2074
|
+
...restOrm<
|
|
2075
|
+
OrmGenerics<any, 'city', iCity, CityPrimaryKeys>
|
|
2076
|
+
>(() => ({
|
|
2077
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2078
|
+
restModel: city
|
|
2079
|
+
}))
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
export const Country = {
|
|
2083
|
+
...country,
|
|
2084
|
+
...restOrm<
|
|
2085
|
+
OrmGenerics<any, 'country', iCountry, CountryPrimaryKeys>
|
|
2086
|
+
>(() => ({
|
|
2087
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2088
|
+
restModel: country
|
|
2089
|
+
}))
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
export const Customer = {
|
|
2093
|
+
...customer,
|
|
2094
|
+
...restOrm<
|
|
2095
|
+
OrmGenerics<any, 'customer', iCustomer, CustomerPrimaryKeys>
|
|
2096
|
+
>(() => ({
|
|
2097
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2098
|
+
restModel: customer
|
|
2099
|
+
}))
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
export const Film = {
|
|
2103
|
+
...film,
|
|
2104
|
+
...restOrm<
|
|
2105
|
+
OrmGenerics<any, 'film', iFilm, FilmPrimaryKeys>
|
|
2106
|
+
>(() => ({
|
|
2107
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2108
|
+
restModel: film
|
|
2109
|
+
}))
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
export const Film_Actor = {
|
|
2113
|
+
...film_actor,
|
|
2114
|
+
...restOrm<
|
|
2115
|
+
OrmGenerics<any, 'film_actor', iFilm_Actor, Film_ActorPrimaryKeys>
|
|
2116
|
+
>(() => ({
|
|
2117
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2118
|
+
restModel: film_actor
|
|
2119
|
+
}))
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
export const Film_Category = {
|
|
2123
|
+
...film_category,
|
|
2124
|
+
...restOrm<
|
|
2125
|
+
OrmGenerics<any, 'film_category', iFilm_Category, Film_CategoryPrimaryKeys>
|
|
2126
|
+
>(() => ({
|
|
2127
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2128
|
+
restModel: film_category
|
|
2129
|
+
}))
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
export const Film_Text = {
|
|
2133
|
+
...film_text,
|
|
2134
|
+
...restOrm<
|
|
2135
|
+
OrmGenerics<any, 'film_text', iFilm_Text, Film_TextPrimaryKeys>
|
|
2136
|
+
>(() => ({
|
|
2137
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2138
|
+
restModel: film_text
|
|
2139
|
+
}))
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
export const Inventory = {
|
|
2143
|
+
...inventory,
|
|
2144
|
+
...restOrm<
|
|
2145
|
+
OrmGenerics<any, 'inventory', iInventory, InventoryPrimaryKeys>
|
|
2146
|
+
>(() => ({
|
|
2147
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2148
|
+
restModel: inventory
|
|
2149
|
+
}))
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
export const Language = {
|
|
2153
|
+
...language,
|
|
2154
|
+
...restOrm<
|
|
2155
|
+
OrmGenerics<any, 'language', iLanguage, LanguagePrimaryKeys>
|
|
2156
|
+
>(() => ({
|
|
2157
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2158
|
+
restModel: language
|
|
2159
|
+
}))
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
export const Payment = {
|
|
2163
|
+
...payment,
|
|
2164
|
+
...restOrm<
|
|
2165
|
+
OrmGenerics<any, 'payment', iPayment, PaymentPrimaryKeys>
|
|
2166
|
+
>(() => ({
|
|
2167
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2168
|
+
restModel: payment
|
|
2169
|
+
}))
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
export const Rental = {
|
|
2173
|
+
...rental,
|
|
2174
|
+
...restOrm<
|
|
2175
|
+
OrmGenerics<any, 'rental', iRental, RentalPrimaryKeys>
|
|
2176
|
+
>(() => ({
|
|
2177
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2178
|
+
restModel: rental
|
|
2179
|
+
}))
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
export const Staff = {
|
|
2183
|
+
...staff,
|
|
2184
|
+
...restOrm<
|
|
2185
|
+
OrmGenerics<any, 'staff', iStaff, StaffPrimaryKeys>
|
|
2186
|
+
>(() => ({
|
|
2187
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2188
|
+
restModel: staff
|
|
2189
|
+
}))
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
export const Store = {
|
|
2193
|
+
...store,
|
|
2194
|
+
...restOrm<
|
|
2195
|
+
OrmGenerics<any, 'store', iStore, StorePrimaryKeys>
|
|
2196
|
+
>(() => ({
|
|
2197
|
+
...GLOBAL_REST_PARAMETERS,
|
|
2198
|
+
restModel: store
|
|
2199
|
+
}))
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
C6.ORM = {
|
|
2203
|
+
Actor, Address, Category, City, Country, Customer, Film, Film_Actor, Film_Category, Film_Text, Inventory, Language, Payment, Rental, Staff, Store,
|
|
2204
|
+
};
|
|
2205
|
+
|
|
2206
|
+
|