@venulog/phasing-engine-schemas 0.2.2-alpha.6 → 0.3.0-alpha.0

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.
@@ -1,6 +1,23 @@
1
1
  import { BookingStatus } from './enums/bookingStatus.js';
2
2
  import { z } from './zod.js';
3
3
  import { PhaseSlotScheduleType } from './enums/phaseSlotScheduleType.js';
4
+ export declare const geometrySchema: z.ZodNullable<z.ZodObject<{
5
+ type: z.ZodEnum<{
6
+ Polygon: "Polygon";
7
+ MultiPolygon: "MultiPolygon";
8
+ Point: "Point";
9
+ LineString: "LineString";
10
+ MultiLineString: "MultiLineString";
11
+ MultiPoint: "MultiPoint";
12
+ }>;
13
+ coordinates: z.ZodArray<z.ZodUnknown>;
14
+ crs: z.ZodOptional<z.ZodObject<{
15
+ type: z.ZodLiteral<"name">;
16
+ properties: z.ZodObject<{
17
+ name: z.ZodString;
18
+ }, z.core.$strip>;
19
+ }, z.core.$strip>>;
20
+ }, z.core.$strip>>;
4
21
  export declare const getEventBookingsQuerySchema: z.ZodObject<{
5
22
  event_code: z.ZodString;
6
23
  seller_id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
@@ -78,6 +95,7 @@ export declare const phaseBookingSchema: z.ZodObject<{
78
95
  booking_date: z.ZodNullable<z.ZodString>;
79
96
  start_time: z.ZodNullable<z.ZodString>;
80
97
  end_time: z.ZodNullable<z.ZodString>;
98
+ company_role: z.ZodNullable<z.ZodString>;
81
99
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
82
100
  vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
83
101
  phase_slot_schedule: z.ZodOptional<z.ZodObject<{
@@ -98,7 +116,6 @@ export declare const phaseBookingSchema: z.ZodObject<{
98
116
  }, z.core.$strip>>;
99
117
  }, z.core.$strip>;
100
118
  export declare const companyDetailsSchema: z.ZodObject<{
101
- company_role: z.ZodString;
102
119
  hall: z.ZodString;
103
120
  stand_number: z.ZodString;
104
121
  company_name: z.ZodString;
@@ -125,8 +142,8 @@ export declare const createBookingBodySchema: z.ZodObject<{
125
142
  }>>;
126
143
  selected_date: z.ZodString;
127
144
  selected_time: z.ZodString;
145
+ company_role: z.ZodString;
128
146
  company: z.ZodObject<{
129
- company_role: z.ZodString;
130
147
  hall: z.ZodString;
131
148
  stand_number: z.ZodString;
132
149
  company_name: z.ZodString;
@@ -153,8 +170,8 @@ export declare const createBookingDataSchema: z.ZodObject<{
153
170
  booking_date: z.ZodString;
154
171
  start_time: z.ZodString;
155
172
  end_time: z.ZodString;
173
+ company_role: z.ZodNullable<z.ZodString>;
156
174
  company: z.ZodObject<{
157
- company_role: z.ZodString;
158
175
  hall: z.ZodString;
159
176
  stand_number: z.ZodString;
160
177
  company_name: z.ZodString;
@@ -186,8 +203,8 @@ export declare const createBookingResponseSchema: z.ZodObject<{
186
203
  booking_date: z.ZodString;
187
204
  start_time: z.ZodString;
188
205
  end_time: z.ZodString;
206
+ company_role: z.ZodNullable<z.ZodString>;
189
207
  company: z.ZodObject<{
190
- company_role: z.ZodString;
191
208
  hall: z.ZodString;
192
209
  stand_number: z.ZodString;
193
210
  company_name: z.ZodString;
@@ -226,6 +243,7 @@ export declare const eventBookingsDataSchema: z.ZodObject<{
226
243
  booking_date: z.ZodNullable<z.ZodString>;
227
244
  start_time: z.ZodNullable<z.ZodString>;
228
245
  end_time: z.ZodNullable<z.ZodString>;
246
+ company_role: z.ZodNullable<z.ZodString>;
229
247
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
230
248
  vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
231
249
  phase_slot_schedule: z.ZodOptional<z.ZodObject<{
@@ -265,6 +283,7 @@ export declare const eventBookingsResponseSchema: z.ZodObject<{
265
283
  booking_date: z.ZodNullable<z.ZodString>;
266
284
  start_time: z.ZodNullable<z.ZodString>;
267
285
  end_time: z.ZodNullable<z.ZodString>;
286
+ company_role: z.ZodNullable<z.ZodString>;
268
287
  company: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
269
288
  vehicle: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
270
289
  phase_slot_schedule: z.ZodOptional<z.ZodObject<{
@@ -351,13 +370,51 @@ export declare const refuseBookingResponseSchema: z.ZodObject<{
351
370
  export declare const createPhaseSlotsBodySchema: z.ZodObject<{
352
371
  event_id: z.ZodNumber;
353
372
  slots: z.ZodArray<z.ZodObject<{
354
- company_role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
+ name: z.ZodString;
374
+ geometry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
375
+ type: z.ZodEnum<{
376
+ Polygon: "Polygon";
377
+ MultiPolygon: "MultiPolygon";
378
+ Point: "Point";
379
+ LineString: "LineString";
380
+ MultiLineString: "MultiLineString";
381
+ MultiPoint: "MultiPoint";
382
+ }>;
383
+ coordinates: z.ZodArray<z.ZodUnknown>;
384
+ crs: z.ZodOptional<z.ZodObject<{
385
+ type: z.ZodLiteral<"name">;
386
+ properties: z.ZodObject<{
387
+ name: z.ZodString;
388
+ }, z.core.$strip>;
389
+ }, z.core.$strip>>;
390
+ }, z.core.$strip>>>;
391
+ site_plan_image_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
392
+ surface_area_sqm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
355
393
  }, z.core.$strip>>;
356
394
  }, z.core.$strip>;
357
395
  export declare const createPhaseSlotDataSchema: z.ZodObject<{
358
396
  slot_id: z.ZodNumber;
359
397
  event_id: z.ZodNumber;
360
- company_role: z.ZodNullable<z.ZodString>;
398
+ name: z.ZodString;
399
+ geometry: z.ZodNullable<z.ZodObject<{
400
+ type: z.ZodEnum<{
401
+ Polygon: "Polygon";
402
+ MultiPolygon: "MultiPolygon";
403
+ Point: "Point";
404
+ LineString: "LineString";
405
+ MultiLineString: "MultiLineString";
406
+ MultiPoint: "MultiPoint";
407
+ }>;
408
+ coordinates: z.ZodArray<z.ZodUnknown>;
409
+ crs: z.ZodOptional<z.ZodObject<{
410
+ type: z.ZodLiteral<"name">;
411
+ properties: z.ZodObject<{
412
+ name: z.ZodString;
413
+ }, z.core.$strip>;
414
+ }, z.core.$strip>>;
415
+ }, z.core.$strip>>;
416
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
417
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
361
418
  is_active: z.ZodBoolean;
362
419
  created_at: z.ZodString;
363
420
  created_by: z.ZodNullable<z.ZodString>;
@@ -368,7 +425,26 @@ export declare const createPhaseSlotsDataSchema: z.ZodObject<{
368
425
  created_slots: z.ZodArray<z.ZodObject<{
369
426
  slot_id: z.ZodNumber;
370
427
  event_id: z.ZodNumber;
371
- company_role: z.ZodNullable<z.ZodString>;
428
+ name: z.ZodString;
429
+ geometry: z.ZodNullable<z.ZodObject<{
430
+ type: z.ZodEnum<{
431
+ Polygon: "Polygon";
432
+ MultiPolygon: "MultiPolygon";
433
+ Point: "Point";
434
+ LineString: "LineString";
435
+ MultiLineString: "MultiLineString";
436
+ MultiPoint: "MultiPoint";
437
+ }>;
438
+ coordinates: z.ZodArray<z.ZodUnknown>;
439
+ crs: z.ZodOptional<z.ZodObject<{
440
+ type: z.ZodLiteral<"name">;
441
+ properties: z.ZodObject<{
442
+ name: z.ZodString;
443
+ }, z.core.$strip>;
444
+ }, z.core.$strip>>;
445
+ }, z.core.$strip>>;
446
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
447
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
372
448
  is_active: z.ZodBoolean;
373
449
  created_at: z.ZodString;
374
450
  created_by: z.ZodNullable<z.ZodString>;
@@ -387,7 +463,26 @@ export declare const createPhaseSlotsResponseSchema: z.ZodObject<{
387
463
  created_slots: z.ZodArray<z.ZodObject<{
388
464
  slot_id: z.ZodNumber;
389
465
  event_id: z.ZodNumber;
390
- company_role: z.ZodNullable<z.ZodString>;
466
+ name: z.ZodString;
467
+ geometry: z.ZodNullable<z.ZodObject<{
468
+ type: z.ZodEnum<{
469
+ Polygon: "Polygon";
470
+ MultiPolygon: "MultiPolygon";
471
+ Point: "Point";
472
+ LineString: "LineString";
473
+ MultiLineString: "MultiLineString";
474
+ MultiPoint: "MultiPoint";
475
+ }>;
476
+ coordinates: z.ZodArray<z.ZodUnknown>;
477
+ crs: z.ZodOptional<z.ZodObject<{
478
+ type: z.ZodLiteral<"name">;
479
+ properties: z.ZodObject<{
480
+ name: z.ZodString;
481
+ }, z.core.$strip>;
482
+ }, z.core.$strip>>;
483
+ }, z.core.$strip>>;
484
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
485
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
391
486
  is_active: z.ZodBoolean;
392
487
  created_at: z.ZodString;
393
488
  created_by: z.ZodNullable<z.ZodString>;
@@ -402,12 +497,50 @@ export declare const updatePhaseSlotParamsSchema: z.ZodObject<{
402
497
  slotId: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
403
498
  }, z.core.$strip>;
404
499
  export declare const updatePhaseSlotBodySchema: z.ZodObject<{
405
- company_role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
500
+ name: z.ZodOptional<z.ZodString>;
501
+ geometry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
502
+ type: z.ZodEnum<{
503
+ Polygon: "Polygon";
504
+ MultiPolygon: "MultiPolygon";
505
+ Point: "Point";
506
+ LineString: "LineString";
507
+ MultiLineString: "MultiLineString";
508
+ MultiPoint: "MultiPoint";
509
+ }>;
510
+ coordinates: z.ZodArray<z.ZodUnknown>;
511
+ crs: z.ZodOptional<z.ZodObject<{
512
+ type: z.ZodLiteral<"name">;
513
+ properties: z.ZodObject<{
514
+ name: z.ZodString;
515
+ }, z.core.$strip>;
516
+ }, z.core.$strip>>;
517
+ }, z.core.$strip>>>;
518
+ site_plan_image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
519
+ surface_area_sqm: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
406
520
  }, z.core.$strip>;
407
521
  export declare const updatePhaseSlotDataSchema: z.ZodObject<{
408
522
  slot_id: z.ZodNumber;
409
523
  event_id: z.ZodNumber;
410
- company_role: z.ZodNullable<z.ZodString>;
524
+ name: z.ZodString;
525
+ geometry: z.ZodNullable<z.ZodObject<{
526
+ type: z.ZodEnum<{
527
+ Polygon: "Polygon";
528
+ MultiPolygon: "MultiPolygon";
529
+ Point: "Point";
530
+ LineString: "LineString";
531
+ MultiLineString: "MultiLineString";
532
+ MultiPoint: "MultiPoint";
533
+ }>;
534
+ coordinates: z.ZodArray<z.ZodUnknown>;
535
+ crs: z.ZodOptional<z.ZodObject<{
536
+ type: z.ZodLiteral<"name">;
537
+ properties: z.ZodObject<{
538
+ name: z.ZodString;
539
+ }, z.core.$strip>;
540
+ }, z.core.$strip>>;
541
+ }, z.core.$strip>>;
542
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
543
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
411
544
  is_active: z.ZodBoolean;
412
545
  updated_at: z.ZodString;
413
546
  updated_by: z.ZodNullable<z.ZodString>;
@@ -418,7 +551,26 @@ export declare const updatePhaseSlotResponseSchema: z.ZodObject<{
418
551
  data: z.ZodObject<{
419
552
  slot_id: z.ZodNumber;
420
553
  event_id: z.ZodNumber;
421
- company_role: z.ZodNullable<z.ZodString>;
554
+ name: z.ZodString;
555
+ geometry: z.ZodNullable<z.ZodObject<{
556
+ type: z.ZodEnum<{
557
+ Polygon: "Polygon";
558
+ MultiPolygon: "MultiPolygon";
559
+ Point: "Point";
560
+ LineString: "LineString";
561
+ MultiLineString: "MultiLineString";
562
+ MultiPoint: "MultiPoint";
563
+ }>;
564
+ coordinates: z.ZodArray<z.ZodUnknown>;
565
+ crs: z.ZodOptional<z.ZodObject<{
566
+ type: z.ZodLiteral<"name">;
567
+ properties: z.ZodObject<{
568
+ name: z.ZodString;
569
+ }, z.core.$strip>;
570
+ }, z.core.$strip>>;
571
+ }, z.core.$strip>>;
572
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
573
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
422
574
  is_active: z.ZodBoolean;
423
575
  updated_at: z.ZodString;
424
576
  updated_by: z.ZodNullable<z.ZodString>;
@@ -435,6 +587,7 @@ export declare const upsertPhaseSlotScheduleItemSchema: z.ZodObject<{
435
587
  assembly: PhaseSlotScheduleType.ASSEMBLY;
436
588
  dismantling: PhaseSlotScheduleType.DISMANTLING;
437
589
  }>;
590
+ company_roles: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
438
591
  }, z.core.$strip>;
439
592
  export declare const deletePhaseSlotScheduleItemSchema: z.ZodObject<{
440
593
  id: z.ZodNumber;
@@ -451,6 +604,7 @@ export declare const upsertPhaseSlotSchedulesBodySchema: z.ZodObject<{
451
604
  assembly: PhaseSlotScheduleType.ASSEMBLY;
452
605
  dismantling: PhaseSlotScheduleType.DISMANTLING;
453
606
  }>;
607
+ company_roles: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
454
608
  }, z.core.$strip>>>;
455
609
  delete: z.ZodOptional<z.ZodArray<z.ZodObject<{
456
610
  id: z.ZodNumber;
@@ -495,6 +649,7 @@ export declare const upsertPhaseSlotSchedulesDataSchema: z.ZodObject<{
495
649
  assembly: PhaseSlotScheduleType.ASSEMBLY;
496
650
  dismantling: PhaseSlotScheduleType.DISMANTLING;
497
651
  }>;
652
+ company_roles: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
498
653
  }, z.core.$strip>, z.ZodObject<{
499
654
  id: z.ZodNumber;
500
655
  }, z.core.$strip>]>;
@@ -542,12 +697,14 @@ export declare const upsertPhaseSlotSchedulesResponseSchema: z.ZodObject<{
542
697
  assembly: PhaseSlotScheduleType.ASSEMBLY;
543
698
  dismantling: PhaseSlotScheduleType.DISMANTLING;
544
699
  }>;
700
+ company_roles: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
545
701
  }, z.core.$strip>, z.ZodObject<{
546
702
  id: z.ZodNumber;
547
703
  }, z.core.$strip>]>;
548
704
  }, z.core.$strip>>;
549
705
  }, z.core.$strip>;
550
706
  }, z.core.$strip>;
707
+ export type Geometry = z.infer<typeof geometrySchema>;
551
708
  export type GetEventBookingsQuery = z.infer<typeof getEventBookingsQuerySchema>;
552
709
  export type VehicleType = z.infer<typeof vehicleTypeSchema>;
553
710
  export type CloseEventParams = z.infer<typeof closeEventParamsSchema>;
@@ -582,10 +739,11 @@ export type DeletePhaseSlotScheduleItem = z.infer<typeof deletePhaseSlotSchedule
582
739
  export type UpsertPhaseSlotSchedulesBody = z.infer<typeof upsertPhaseSlotSchedulesBodySchema>;
583
740
  export type UpsertPhaseSlotSchedulesData = z.infer<typeof upsertPhaseSlotSchedulesDataSchema>;
584
741
  export type UpsertPhaseSlotSchedulesResponse = z.infer<typeof upsertPhaseSlotSchedulesResponseSchema>;
585
- export declare const checkSlotAvailabilityQuerySchema: z.ZodObject<{
586
- schedule_id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
742
+ export declare const checkSlotAvailabilityBodySchema: z.ZodObject<{
743
+ schedule_id: z.ZodNumber;
587
744
  date: z.ZodString;
588
745
  start_time: z.ZodString;
746
+ company_role: z.ZodString;
589
747
  }, z.core.$strip>;
590
748
  export declare const checkSlotAvailabilityDataSchema: z.ZodObject<{
591
749
  schedule_id: z.ZodNumber;
@@ -610,6 +768,6 @@ export declare const checkSlotAvailabilityResponseSchema: z.ZodObject<{
610
768
  available_capacity: z.ZodNumber;
611
769
  }, z.core.$strip>;
612
770
  }, z.core.$strip>;
613
- export type CheckSlotAvailabilityQuery = z.infer<typeof checkSlotAvailabilityQuerySchema>;
771
+ export type CheckSlotAvailabilityBody = z.infer<typeof checkSlotAvailabilityBodySchema>;
614
772
  export type CheckSlotAvailabilityData = z.infer<typeof checkSlotAvailabilityDataSchema>;
615
773
  export type CheckSlotAvailabilityResponse = z.infer<typeof checkSlotAvailabilityResponseSchema>;
@@ -4,6 +4,43 @@ import { BookingStatus } from './enums/bookingStatus.js';
4
4
  import { createSuccessResponseSchema, createMessageDataResponseSchema } from './common.js';
5
5
  import { z } from './zod.js';
6
6
  import { PhaseSlotScheduleType } from './enums/phaseSlotScheduleType.js';
7
+ // PostGIS geometry schema (GeoJSON-like structure)
8
+ export const geometrySchema = z
9
+ .object({
10
+ type: z.enum([
11
+ 'Polygon',
12
+ 'MultiPolygon',
13
+ 'Point',
14
+ 'LineString',
15
+ 'MultiLineString',
16
+ 'MultiPoint'
17
+ ]),
18
+ coordinates: z.array(z.unknown()),
19
+ crs: z
20
+ .object({
21
+ type: z.literal('name'),
22
+ properties: z.object({
23
+ name: z.string()
24
+ })
25
+ })
26
+ .optional()
27
+ })
28
+ .nullable()
29
+ .openapi({
30
+ description: 'PostGIS geometry object (GeoJSON format)',
31
+ example: {
32
+ type: 'Polygon',
33
+ coordinates: [
34
+ [
35
+ [2.3522, 48.8566],
36
+ [2.3532, 48.8566],
37
+ [2.3532, 48.8576],
38
+ [2.3522, 48.8576],
39
+ [2.3522, 48.8566]
40
+ ]
41
+ ]
42
+ }
43
+ });
7
44
  // ------------------------------
8
45
  // Query parameters schema
9
46
  // ------------------------------
@@ -139,6 +176,7 @@ export const phaseBookingSchema = z.object({
139
176
  booking_date: z.string().nullable(),
140
177
  start_time: z.string().nullable(),
141
178
  end_time: z.string().nullable(),
179
+ company_role: z.string().nullable(),
142
180
  company: z.record(z.string(), z.unknown()).nullable().optional(),
143
181
  vehicle: z.record(z.string(), z.unknown()).nullable().optional(),
144
182
  // Include the schedule details
@@ -146,10 +184,6 @@ export const phaseBookingSchema = z.object({
146
184
  });
147
185
  export const companyDetailsSchema = z
148
186
  .object({
149
- company_role: z.string().min(1, 'Company role is required').openapi({
150
- description: 'Company role',
151
- example: 'exhibitor'
152
- }),
153
187
  hall: z.string().min(1, 'Hall is required').openapi({
154
188
  description: 'Hall location',
155
189
  example: 'Hall 1'
@@ -245,6 +279,11 @@ export const createBookingBodySchema = z
245
279
  description: 'Selected time slot (HH:MM)',
246
280
  example: '08:00'
247
281
  }),
282
+ // Company role for this booking
283
+ company_role: z.string().min(1, 'Company role is required').openapi({
284
+ description: 'Company role for this booking',
285
+ example: 'exhibitor'
286
+ }),
248
287
  // Company details
249
288
  company: companyDetailsSchema.openapi({
250
289
  description: 'Company details including stand, contact, and driver info'
@@ -281,6 +320,10 @@ export const createBookingDataSchema = z
281
320
  description: 'End time',
282
321
  example: '08:30'
283
322
  }),
323
+ company_role: z.string().nullable().openapi({
324
+ description: 'Company role for this booking',
325
+ example: 'exhibitor'
326
+ }),
284
327
  company: companyDetailsSchema.openapi({
285
328
  description: 'Company details including stand, contact, and driver info'
286
329
  }),
@@ -418,15 +461,45 @@ export const createPhaseSlotsBodySchema = z
418
461
  }),
419
462
  slots: z
420
463
  .array(z.object({
421
- company_role: z.string().min(1).nullable().optional().openapi({
422
- description: 'Optional company role for the slot',
423
- example: 'buyer'
464
+ name: z.string().min(1, 'Name is required and cannot be empty').openapi({
465
+ description: 'Name of the parking area (required)',
466
+ example: 'Zone A - Loading Dock'
467
+ }),
468
+ geometry: geometrySchema.optional().openapi({
469
+ description: 'PostGIS polygon geometry representing the parking area boundary (optional)',
470
+ example: {
471
+ type: 'Polygon',
472
+ coordinates: [
473
+ [
474
+ [2.3522, 48.8566],
475
+ [2.3532, 48.8566],
476
+ [2.3532, 48.8576],
477
+ [2.3522, 48.8576],
478
+ [2.3522, 48.8566]
479
+ ]
480
+ ]
481
+ }
482
+ }),
483
+ site_plan_image_url: z.url().nullable().optional().openapi({
484
+ description: 'URL to the site plan image (optional)',
485
+ example: 'https://storage.example.com/plans/zone-a.jpg'
486
+ }),
487
+ surface_area_sqm: z.number().positive().nullable().optional().openapi({
488
+ description: 'Surface area in square meters (optional, must be positive if provided)',
489
+ example: 150.5
424
490
  })
425
491
  }))
426
492
  .min(1, 'At least one slot must be provided')
427
493
  .openapi({
428
- description: 'Array of slots to create',
429
- example: [{ company_role: 'buyer' }, { company_role: 'seller' }]
494
+ description: 'Array of slots to create with their properties',
495
+ example: [
496
+ {
497
+ name: 'Zone A - Loading Dock',
498
+ geometry: null,
499
+ site_plan_image_url: 'https://storage.example.com/plans/zone-a.jpg',
500
+ surface_area_sqm: 150.5
501
+ }
502
+ ]
430
503
  })
431
504
  })
432
505
  .openapi('CreatePhaseSlotsBody');
@@ -440,9 +513,32 @@ export const createPhaseSlotDataSchema = z
440
513
  description: 'ID of the event',
441
514
  example: 1
442
515
  }),
443
- company_role: z.string().nullable().openapi({
444
- description: 'Company role',
445
- example: 'buyer'
516
+ name: z.string().openapi({
517
+ description: 'Name of the parking area',
518
+ example: 'Zone A - Loading Dock'
519
+ }),
520
+ geometry: geometrySchema.openapi({
521
+ description: 'PostGIS polygon geometry representing the parking area boundary',
522
+ example: {
523
+ type: 'Polygon',
524
+ coordinates: [
525
+ [
526
+ [2.3522, 48.8566],
527
+ [2.3532, 48.8566],
528
+ [2.3532, 48.8576],
529
+ [2.3522, 48.8576],
530
+ [2.3522, 48.8566]
531
+ ]
532
+ ]
533
+ }
534
+ }),
535
+ site_plan_image_url: z.string().nullable().openapi({
536
+ description: 'URL to the site plan image',
537
+ example: 'https://storage.example.com/plans/zone-a.jpg'
538
+ }),
539
+ surface_area_sqm: z.number().nullable().openapi({
540
+ description: 'Surface area in square meters',
541
+ example: 150.5
446
542
  }),
447
543
  is_active: z.boolean().openapi({
448
544
  description: 'Whether the slot is active',
@@ -509,9 +605,32 @@ export const updatePhaseSlotParamsSchema = z
509
605
  .openapi('UpdatePhaseSlotParams');
510
606
  export const updatePhaseSlotBodySchema = z
511
607
  .object({
512
- company_role: z.string().min(1).nullable().optional().openapi({
513
- description: 'New company role for the slot',
514
- example: 'seller'
608
+ name: z.string().min(1, 'Name cannot be empty').optional().openapi({
609
+ description: 'New name for the parking area',
610
+ example: 'Zone B - Assembly Area'
611
+ }),
612
+ geometry: geometrySchema.optional().openapi({
613
+ description: 'New PostGIS polygon geometry',
614
+ example: {
615
+ type: 'Polygon',
616
+ coordinates: [
617
+ [
618
+ [2.3522, 48.8566],
619
+ [2.3532, 48.8566],
620
+ [2.3532, 48.8576],
621
+ [2.3522, 48.8576],
622
+ [2.3522, 48.8566]
623
+ ]
624
+ ]
625
+ }
626
+ }),
627
+ site_plan_image_url: z.string().url().nullable().optional().openapi({
628
+ description: 'New site plan image URL',
629
+ example: 'https://storage.example.com/plans/zone-b.jpg'
630
+ }),
631
+ surface_area_sqm: z.number().positive().nullable().optional().openapi({
632
+ description: 'New surface area in square meters (must be positive if provided)',
633
+ example: 200.0
515
634
  })
516
635
  })
517
636
  .refine(data => Object.keys(data).length > 0, {
@@ -528,9 +647,32 @@ export const updatePhaseSlotDataSchema = z
528
647
  description: 'ID of the event',
529
648
  example: 1
530
649
  }),
531
- company_role: z.string().nullable().openapi({
532
- description: 'Updated company role',
533
- example: 'seller'
650
+ name: z.string().openapi({
651
+ description: 'Name of the parking area',
652
+ example: 'Zone B - Assembly Area'
653
+ }),
654
+ geometry: geometrySchema.openapi({
655
+ description: 'PostGIS polygon geometry representing the parking area boundary',
656
+ example: {
657
+ type: 'Polygon',
658
+ coordinates: [
659
+ [
660
+ [2.3522, 48.8566],
661
+ [2.3532, 48.8566],
662
+ [2.3532, 48.8576],
663
+ [2.3522, 48.8576],
664
+ [2.3522, 48.8566]
665
+ ]
666
+ ]
667
+ }
668
+ }),
669
+ site_plan_image_url: z.string().nullable().openapi({
670
+ description: 'URL to the site plan image',
671
+ example: 'https://storage.example.com/plans/zone-b.jpg'
672
+ }),
673
+ surface_area_sqm: z.number().nullable().openapi({
674
+ description: 'Surface area in square meters',
675
+ example: 200.0
534
676
  }),
535
677
  is_active: z.boolean().openapi({
536
678
  description: 'Whether the slot is active',
@@ -592,6 +734,14 @@ export const upsertPhaseSlotScheduleItemSchema = z
592
734
  .openapi({
593
735
  description: 'Type of schedule',
594
736
  example: PhaseSlotScheduleType.ASSEMBLY
737
+ }),
738
+ company_roles: z
739
+ .array(z.string())
740
+ .nullable()
741
+ .optional()
742
+ .openapi({
743
+ description: 'Array of company roles allowed for this schedule (moved from phase_slots)',
744
+ example: ['exhibitor', 'organizer', 'contractor']
595
745
  })
596
746
  })
597
747
  .openapi('UpsertPhaseSlotScheduleItem');
@@ -692,18 +842,11 @@ export const upsertPhaseSlotSchedulesResponseSchema = createMessageDataResponseS
692
842
  // ------------------------------
693
843
  // Check Slot Availability schemas
694
844
  // ------------------------------
695
- export const checkSlotAvailabilityQuerySchema = z
845
+ export const checkSlotAvailabilityBodySchema = z
696
846
  .object({
697
- schedule_id: z
698
- .string()
699
- .min(1)
700
- .transform(val => parseInt(val, 10))
701
- .refine(val => !isNaN(val) && val > 0, {
702
- message: 'Schedule ID must be a positive number'
703
- })
704
- .openapi({
847
+ schedule_id: z.number().positive().openapi({
705
848
  description: 'The ID of the phase slot schedule',
706
- example: '1'
849
+ example: 1
707
850
  }),
708
851
  date: z
709
852
  .string()
@@ -718,9 +861,13 @@ export const checkSlotAvailabilityQuerySchema = z
718
861
  .openapi({
719
862
  description: 'The start time to check availability (HH:MM)',
720
863
  example: '08:00'
864
+ }),
865
+ company_role: z.string().min(1, 'Company role is required').openapi({
866
+ description: 'Company role to check availability for',
867
+ example: 'exhibitor'
721
868
  })
722
869
  })
723
- .openapi('CheckSlotAvailabilityQuery');
870
+ .openapi('CheckSlotAvailabilityBody');
724
871
  export const checkSlotAvailabilityDataSchema = z
725
872
  .object({
726
873
  schedule_id: z.number().openapi({
@@ -1,9 +1,9 @@
1
1
  import { z } from './zod.js';
2
- export declare const getAvailableSlotsQuerySchema: z.ZodObject<{
3
- event_id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
4
- year: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
5
- month: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
6
- phase_slot_id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
2
+ export declare const getAvailableSlotsBodySchema: z.ZodObject<{
3
+ event_id: z.ZodNumber;
4
+ year: z.ZodNumber;
5
+ month: z.ZodNumber;
6
+ company_role: z.ZodString;
7
7
  schedule_type: z.ZodOptional<z.ZodEnum<{
8
8
  assembly: "assembly";
9
9
  dismantling: "dismantling";
@@ -29,7 +29,7 @@ export declare const availableSlotsResponseSchema: z.ZodObject<{
29
29
  event_id: z.ZodNumber;
30
30
  event_code: z.ZodString;
31
31
  event_name: z.ZodString;
32
- company_role: z.ZodNullable<z.ZodString>;
32
+ company_role: z.ZodString;
33
33
  year: z.ZodNumber;
34
34
  month: z.ZodNumber;
35
35
  available_slots: z.ZodArray<z.ZodObject<{
@@ -56,7 +56,26 @@ export declare const getPhaseSlotsByEventIdParamsSchema: z.ZodObject<{
56
56
  export declare const phaseSlotItemSchema: z.ZodObject<{
57
57
  id: z.ZodNumber;
58
58
  event_id: z.ZodNumber;
59
- company_role: z.ZodNullable<z.ZodString>;
59
+ name: z.ZodString;
60
+ geometry: z.ZodNullable<z.ZodObject<{
61
+ type: z.ZodEnum<{
62
+ Polygon: "Polygon";
63
+ MultiPolygon: "MultiPolygon";
64
+ Point: "Point";
65
+ LineString: "LineString";
66
+ MultiLineString: "MultiLineString";
67
+ MultiPoint: "MultiPoint";
68
+ }>;
69
+ coordinates: z.ZodArray<z.ZodUnknown>;
70
+ crs: z.ZodOptional<z.ZodObject<{
71
+ type: z.ZodLiteral<"name">;
72
+ properties: z.ZodObject<{
73
+ name: z.ZodString;
74
+ }, z.core.$strip>;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>>;
77
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
78
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
60
79
  is_active: z.ZodBoolean;
61
80
  created_at: z.ZodString;
62
81
  updated_at: z.ZodString;
@@ -68,7 +87,26 @@ export declare const getPhaseSlotsResponseSchema: z.ZodObject<{
68
87
  slots: z.ZodArray<z.ZodObject<{
69
88
  id: z.ZodNumber;
70
89
  event_id: z.ZodNumber;
71
- company_role: z.ZodNullable<z.ZodString>;
90
+ name: z.ZodString;
91
+ geometry: z.ZodNullable<z.ZodObject<{
92
+ type: z.ZodEnum<{
93
+ Polygon: "Polygon";
94
+ MultiPolygon: "MultiPolygon";
95
+ Point: "Point";
96
+ LineString: "LineString";
97
+ MultiLineString: "MultiLineString";
98
+ MultiPoint: "MultiPoint";
99
+ }>;
100
+ coordinates: z.ZodArray<z.ZodUnknown>;
101
+ crs: z.ZodOptional<z.ZodObject<{
102
+ type: z.ZodLiteral<"name">;
103
+ properties: z.ZodObject<{
104
+ name: z.ZodString;
105
+ }, z.core.$strip>;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strip>>;
108
+ site_plan_image_url: z.ZodNullable<z.ZodString>;
109
+ surface_area_sqm: z.ZodNullable<z.ZodNumber>;
72
110
  is_active: z.ZodBoolean;
73
111
  created_at: z.ZodString;
74
112
  updated_at: z.ZodString;
@@ -77,9 +115,23 @@ export declare const getPhaseSlotsResponseSchema: z.ZodObject<{
77
115
  }, z.core.$strip>>;
78
116
  total_count: z.ZodNumber;
79
117
  }, z.core.$strip>;
80
- export type GetAvailableSlotsQuery = z.infer<typeof getAvailableSlotsQuerySchema>;
118
+ export declare const getCompanyRolesByEventIdParamsSchema: z.ZodObject<{
119
+ eventId: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
120
+ scheduleType: z.ZodEnum<{
121
+ assembly: "assembly";
122
+ dismantling: "dismantling";
123
+ }>;
124
+ }, z.core.$strip>;
125
+ export declare const getCompanyRolesByEventIdResponseSchema: z.ZodObject<{
126
+ event_id: z.ZodNumber;
127
+ company_roles: z.ZodArray<z.ZodString>;
128
+ total_count: z.ZodNumber;
129
+ }, z.core.$strip>;
130
+ export type GetAvailableSlotsBody = z.infer<typeof getAvailableSlotsBodySchema>;
81
131
  export type AvailableTimeSlot = z.infer<typeof availableTimeSlotSchema>;
82
132
  export type AvailableSlotsResponse = z.infer<typeof availableSlotsResponseSchema>;
83
133
  export type GetPhaseSlotsByEventIdParams = z.infer<typeof getPhaseSlotsByEventIdParamsSchema>;
84
134
  export type PhaseSlotItem = z.infer<typeof phaseSlotItemSchema>;
85
135
  export type GetPhaseSlotsResponse = z.infer<typeof getPhaseSlotsResponseSchema>;
136
+ export type GetCompanyRolesByEventIdParams = z.infer<typeof getCompanyRolesByEventIdParamsSchema>;
137
+ export type GetCompanyRolesByEventIdResponse = z.infer<typeof getCompanyRolesByEventIdResponseSchema>;
package/dist/phaseSlot.js CHANGED
@@ -3,52 +3,30 @@ import { z } from './zod.js';
3
3
  // ------------------------------
4
4
  // Query parameters schema
5
5
  // ------------------------------
6
- export const getAvailableSlotsQuerySchema = z
6
+ export const getAvailableSlotsBodySchema = z
7
7
  .object({
8
- event_id: z
9
- .string()
10
- .min(1)
11
- .transform(val => parseInt(val, 10))
12
- .refine(val => !isNaN(val) && val > 0, {
13
- message: 'Event ID must be a positive number'
14
- })
15
- .openapi({
8
+ event_id: z.number().positive().openapi({
16
9
  description: 'The ID of the event',
17
- example: '1'
10
+ example: 1
18
11
  }),
19
- year: z
20
- .string()
21
- .regex(/^\d{4}$/, 'Year must be in YYYY format')
22
- .transform(val => parseInt(val, 10))
23
- .openapi({
12
+ year: z.number().min(2024).openapi({
24
13
  description: 'Year for filtering slots (YYYY). Slots before today will be excluded.',
25
- example: '2026'
14
+ example: 2026
26
15
  }),
27
- month: z
28
- .string()
29
- .regex(/^(0?[1-9]|1[0-2])$/, 'Month must be between 1 and 12')
30
- .transform(val => parseInt(val, 10))
31
- .openapi({
16
+ month: z.number().min(1).max(12).openapi({
32
17
  description: 'Month for filtering slots (1-12). Slots before today will be excluded.',
33
- example: '6'
18
+ example: 6
34
19
  }),
35
- phase_slot_id: z
36
- .string()
37
- .min(1)
38
- .transform(val => parseInt(val, 10))
39
- .refine(val => !isNaN(val) && val > 0, {
40
- message: 'Phase slot ID must be a positive number'
41
- })
42
- .openapi({
43
- description: 'The ID of the phase slot',
44
- example: '1'
20
+ company_role: z.string().min(1, 'Company role is required').openapi({
21
+ description: 'Company role to filter schedules by',
22
+ example: 'exhibitor'
45
23
  }),
46
24
  schedule_type: z.enum(['assembly', 'dismantling']).optional().openapi({
47
25
  description: 'Filter by schedule type',
48
26
  example: 'assembly'
49
27
  })
50
28
  })
51
- .openapi('GetAvailableSlotsQuery');
29
+ .openapi('GetAvailableSlotsBody');
52
30
  // ------------------------------
53
31
  // Response schemas
54
32
  // ------------------------------
@@ -114,8 +92,8 @@ export const availableSlotsResponseSchema = z
114
92
  description: 'Name of the event',
115
93
  example: 'COEC 2025'
116
94
  }),
117
- company_role: z.string().nullable().openapi({
118
- description: 'Company role for the phase slots',
95
+ company_role: z.string().openapi({
96
+ description: 'Company role that was used for filtering (returned for reference)',
119
97
  example: 'exhibitor'
120
98
  }),
121
99
  year: z.number().openapi({
@@ -163,9 +141,53 @@ export const phaseSlotItemSchema = z
163
141
  description: 'Event ID',
164
142
  example: 1
165
143
  }),
166
- company_role: z.string().nullable().openapi({
167
- description: 'Company role for this slot',
168
- example: 'exhibitor'
144
+ name: z.string().openapi({
145
+ description: 'Name of the parking area',
146
+ example: 'Zone A - Loading Dock'
147
+ }),
148
+ geometry: z
149
+ .object({
150
+ type: z.enum([
151
+ 'Polygon',
152
+ 'MultiPolygon',
153
+ 'Point',
154
+ 'LineString',
155
+ 'MultiLineString',
156
+ 'MultiPoint'
157
+ ]),
158
+ coordinates: z.array(z.unknown()),
159
+ crs: z
160
+ .object({
161
+ type: z.literal('name'),
162
+ properties: z.object({
163
+ name: z.string()
164
+ })
165
+ })
166
+ .optional()
167
+ })
168
+ .nullable()
169
+ .openapi({
170
+ description: 'PostGIS polygon geometry representing the parking area boundary (GeoJSON format)',
171
+ example: {
172
+ type: 'Polygon',
173
+ coordinates: [
174
+ [
175
+ [2.3522, 48.8566],
176
+ [2.3532, 48.8566],
177
+ [2.3532, 48.8576],
178
+ [2.3522, 48.8576],
179
+ [2.3522, 48.8566]
180
+ ]
181
+ ]
182
+ }
183
+ }),
184
+ site_plan_image_url: z.string().nullable().openapi({
185
+ description: 'URL to the site plan image',
186
+ example: 'https://storage.example.com/plans/zone-a.jpg'
187
+ }),
188
+ surface_area_sqm: z.number().nullable().openapi({
189
+ description: 'Surface area in square meters',
190
+ example: 150.5
169
191
  }),
170
192
  is_active: z.boolean().openapi({
171
193
  description: 'Whether the slot is active',
@@ -204,3 +226,36 @@ export const getPhaseSlotsResponseSchema = z
204
226
  })
205
227
  })
206
228
  .openapi('GetPhaseSlotsResponse');
229
+ export const getCompanyRolesByEventIdParamsSchema = z
230
+ .object({
231
+ eventId: z
232
+ .string()
233
+ .min(1, 'Event ID is required')
234
+ .transform(val => parseInt(val, 10))
235
+ .refine(val => !isNaN(val) && val > 0, { message: 'Event ID must be positive' })
236
+ .openapi({
237
+ description: 'The ID of the event to get company roles for',
238
+ example: '1'
239
+ }),
240
+ scheduleType: z.enum(['assembly', 'dismantling']).openapi({
241
+ description: 'Type of schedule',
242
+ example: 'assembly'
243
+ })
244
+ })
245
+ .openapi('GetCompanyRolesByEventIdParams');
246
+ export const getCompanyRolesByEventIdResponseSchema = z
247
+ .object({
248
+ event_id: z.number().openapi({
249
+ description: 'ID of the event',
250
+ example: 1
251
+ }),
252
+ company_roles: z.array(z.string()).openapi({
253
+ description: 'List of unique company roles for the event',
254
+ example: ['exhibitor', 'organizer', 'contractor']
255
+ }),
256
+ total_count: z.number().openapi({
257
+ description: 'Total number of unique company roles',
258
+ example: 3
259
+ })
260
+ })
261
+ .openapi('GetCompanyRolesByEventIdResponse');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venulog/phasing-engine-schemas",
3
- "version": "0.2.2-alpha.6",
3
+ "version": "0.3.0-alpha.0",
4
4
  "description": "Shared schemas and types for Phasing Engine API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",