@venulog/phasing-engine-schemas 0.2.0-alpha.0 → 0.2.0-alpha.2
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/dist/enums/phaseSlotScheduleType.d.ts +4 -0
- package/dist/enums/phaseSlotScheduleType.js +5 -0
- package/dist/event.d.ts +18 -0
- package/dist/event.js +40 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/phaseBooking.d.ts +224 -358
- package/dist/phaseBooking.js +318 -452
- package/dist/phaseSlot.d.ts +60 -57
- package/dist/phaseSlot.js +187 -55
- package/package.json +5 -1
- package/dist/enums/slotStatus.d.ts +0 -5
- package/dist/enums/slotStatus.js +0 -6
package/dist/phaseSlot.d.ts
CHANGED
|
@@ -1,82 +1,85 @@
|
|
|
1
1
|
import { z } from './zod.js';
|
|
2
|
-
import { SlotStatus } from './enums/slotStatus.js';
|
|
3
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>>;
|
|
7
|
+
schedule_type: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
assembly: "assembly";
|
|
9
|
+
dismantling: "dismantling";
|
|
10
|
+
}>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const availableTimeSlotSchema: z.ZodObject<{
|
|
13
|
+
phase_slot_schedule_id: z.ZodNumber;
|
|
14
|
+
date: z.ZodString;
|
|
15
|
+
start_time: z.ZodString;
|
|
16
|
+
end_time: z.ZodString;
|
|
17
|
+
duration: z.ZodNumber;
|
|
18
|
+
schedule_type: z.ZodEnum<{
|
|
19
|
+
assembly: "assembly";
|
|
20
|
+
dismantling: "dismantling";
|
|
21
|
+
}>;
|
|
22
|
+
max_capacity: z.ZodNumber;
|
|
23
|
+
current_bookings: z.ZodNumber;
|
|
24
|
+
confirmed_bookings: z.ZodNumber;
|
|
25
|
+
available_capacity: z.ZodNumber;
|
|
26
|
+
is_available: z.ZodBoolean;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const availableSlotsResponseSchema: z.ZodObject<{
|
|
29
|
+
event_id: z.ZodNumber;
|
|
4
30
|
event_code: z.ZodString;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
31
|
+
event_name: z.ZodString;
|
|
32
|
+
company_role: z.ZodNullable<z.ZodString>;
|
|
33
|
+
year: z.ZodNumber;
|
|
34
|
+
month: z.ZodNumber;
|
|
35
|
+
available_slots: z.ZodArray<z.ZodObject<{
|
|
36
|
+
phase_slot_schedule_id: z.ZodNumber;
|
|
37
|
+
date: z.ZodString;
|
|
38
|
+
start_time: z.ZodString;
|
|
39
|
+
end_time: z.ZodString;
|
|
40
|
+
duration: z.ZodNumber;
|
|
41
|
+
schedule_type: z.ZodEnum<{
|
|
42
|
+
assembly: "assembly";
|
|
43
|
+
dismantling: "dismantling";
|
|
15
44
|
}>;
|
|
16
|
-
|
|
45
|
+
max_capacity: z.ZodNumber;
|
|
46
|
+
current_bookings: z.ZodNumber;
|
|
47
|
+
confirmed_bookings: z.ZodNumber;
|
|
48
|
+
available_capacity: z.ZodNumber;
|
|
49
|
+
is_available: z.ZodBoolean;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
total_slots: z.ZodNumber;
|
|
17
52
|
}, z.core.$strip>;
|
|
18
|
-
export declare const
|
|
19
|
-
|
|
20
|
-
name: z.ZodString;
|
|
21
|
-
code: z.ZodString;
|
|
22
|
-
height: z.ZodString;
|
|
23
|
-
surface_area_side: z.ZodNumber;
|
|
24
|
-
surface_aread_back: z.ZodNumber;
|
|
25
|
-
loading_duration: z.ZodNumber;
|
|
53
|
+
export declare const getPhaseSlotsByEventIdParamsSchema: z.ZodObject<{
|
|
54
|
+
eventId: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
|
|
26
55
|
}, z.core.$strip>;
|
|
27
|
-
export declare const
|
|
56
|
+
export declare const phaseSlotItemSchema: z.ZodObject<{
|
|
28
57
|
id: z.ZodNumber;
|
|
29
58
|
event_id: z.ZodNumber;
|
|
30
|
-
slot_number: z.ZodNumber;
|
|
31
|
-
vehicle_type_id: z.ZodNullable<z.ZodNumber>;
|
|
32
59
|
company_role: z.ZodNullable<z.ZodString>;
|
|
33
|
-
status: z.ZodEnum<typeof SlotStatus>;
|
|
34
60
|
is_active: z.ZodBoolean;
|
|
35
61
|
created_at: z.ZodString;
|
|
36
62
|
updated_at: z.ZodString;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
name: z.ZodString;
|
|
40
|
-
code: z.ZodString;
|
|
41
|
-
height: z.ZodString;
|
|
42
|
-
surface_area_side: z.ZodNumber;
|
|
43
|
-
surface_aread_back: z.ZodNumber;
|
|
44
|
-
loading_duration: z.ZodNumber;
|
|
45
|
-
}, z.core.$strip>>>;
|
|
63
|
+
created_by: z.ZodNullable<z.ZodString>;
|
|
64
|
+
updated_by: z.ZodNullable<z.ZodString>;
|
|
46
65
|
}, z.core.$strip>;
|
|
47
|
-
export declare const
|
|
66
|
+
export declare const getPhaseSlotsResponseSchema: z.ZodObject<{
|
|
48
67
|
event_id: z.ZodNumber;
|
|
49
|
-
|
|
50
|
-
phase_status: z.ZodString;
|
|
51
|
-
available_slots: z.ZodArray<z.ZodObject<{
|
|
68
|
+
slots: z.ZodArray<z.ZodObject<{
|
|
52
69
|
id: z.ZodNumber;
|
|
53
70
|
event_id: z.ZodNumber;
|
|
54
|
-
slot_number: z.ZodNumber;
|
|
55
|
-
vehicle_type_id: z.ZodNullable<z.ZodNumber>;
|
|
56
71
|
company_role: z.ZodNullable<z.ZodString>;
|
|
57
|
-
status: z.ZodEnum<typeof SlotStatus>;
|
|
58
72
|
is_active: z.ZodBoolean;
|
|
59
73
|
created_at: z.ZodString;
|
|
60
74
|
updated_at: z.ZodString;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
name: z.ZodString;
|
|
64
|
-
code: z.ZodString;
|
|
65
|
-
height: z.ZodString;
|
|
66
|
-
surface_area_side: z.ZodNumber;
|
|
67
|
-
surface_aread_back: z.ZodNumber;
|
|
68
|
-
loading_duration: z.ZodNumber;
|
|
69
|
-
}, z.core.$strip>>>;
|
|
75
|
+
created_by: z.ZodNullable<z.ZodString>;
|
|
76
|
+
updated_by: z.ZodNullable<z.ZodString>;
|
|
70
77
|
}, z.core.$strip>>;
|
|
71
78
|
total_count: z.ZodNumber;
|
|
72
79
|
}, z.core.$strip>;
|
|
73
|
-
export declare const availableSlotsFiltersSchema: z.ZodObject<{
|
|
74
|
-
provider_id: z.ZodOptional<z.ZodNumber>;
|
|
75
|
-
vehicle_type_id: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
min_priority: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
}, z.core.$strip>;
|
|
78
80
|
export type GetAvailableSlotsQuery = z.infer<typeof getAvailableSlotsQuerySchema>;
|
|
79
|
-
export type
|
|
81
|
+
export type AvailableTimeSlot = z.infer<typeof availableTimeSlotSchema>;
|
|
80
82
|
export type AvailableSlotsResponse = z.infer<typeof availableSlotsResponseSchema>;
|
|
81
|
-
export type
|
|
82
|
-
export type
|
|
83
|
+
export type GetPhaseSlotsByEventIdParams = z.infer<typeof getPhaseSlotsByEventIdParamsSchema>;
|
|
84
|
+
export type PhaseSlotItem = z.infer<typeof phaseSlotItemSchema>;
|
|
85
|
+
export type GetPhaseSlotsResponse = z.infer<typeof getPhaseSlotsResponseSchema>;
|
package/dist/phaseSlot.js
CHANGED
|
@@ -1,74 +1,206 @@
|
|
|
1
1
|
// packages/phasing-schemas/src/phaseSlot.ts
|
|
2
2
|
import { z } from './zod.js';
|
|
3
|
-
import { paginationSchema } from './pagination.js';
|
|
4
|
-
import { vehicleTypeSchema } from './phaseBooking.js';
|
|
5
|
-
import { SlotStatus } from './enums/slotStatus.js';
|
|
6
3
|
// ------------------------------
|
|
7
4
|
// Query parameters schema
|
|
8
5
|
// ------------------------------
|
|
9
6
|
export const getAvailableSlotsQuerySchema = z
|
|
10
7
|
.object({
|
|
11
|
-
|
|
12
|
-
provider_id: z
|
|
8
|
+
event_id: z
|
|
13
9
|
.string()
|
|
14
|
-
.
|
|
15
|
-
.transform(val =>
|
|
16
|
-
.refine(val =>
|
|
17
|
-
message: '
|
|
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({
|
|
16
|
+
description: 'The ID of the event',
|
|
17
|
+
example: '1'
|
|
18
|
+
}),
|
|
19
|
+
year: z
|
|
20
|
+
.string()
|
|
21
|
+
.regex(/^\d{4}$/, 'Year must be in YYYY format')
|
|
22
|
+
.transform(val => parseInt(val, 10))
|
|
23
|
+
.openapi({
|
|
24
|
+
description: 'Year for filtering slots (YYYY). Slots before today will be excluded.',
|
|
25
|
+
example: '2026'
|
|
18
26
|
}),
|
|
19
|
-
|
|
27
|
+
month: z
|
|
20
28
|
.string()
|
|
21
|
-
.
|
|
22
|
-
.transform(val =>
|
|
23
|
-
.
|
|
24
|
-
|
|
29
|
+
.regex(/^(0?[1-9]|1[0-2])$/, 'Month must be between 1 and 12')
|
|
30
|
+
.transform(val => parseInt(val, 10))
|
|
31
|
+
.openapi({
|
|
32
|
+
description: 'Month for filtering slots (1-12). Slots before today will be excluded.',
|
|
33
|
+
example: '6'
|
|
25
34
|
}),
|
|
26
|
-
|
|
35
|
+
phase_slot_id: z
|
|
27
36
|
.string()
|
|
28
|
-
.
|
|
29
|
-
.transform(val =>
|
|
30
|
-
.refine(val => val
|
|
31
|
-
message: '
|
|
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'
|
|
45
|
+
}),
|
|
46
|
+
schedule_type: z.enum(['assembly', 'dismantling']).optional().openapi({
|
|
47
|
+
description: 'Filter by schedule type',
|
|
48
|
+
example: 'assembly'
|
|
32
49
|
})
|
|
33
50
|
})
|
|
34
|
-
.
|
|
35
|
-
// ------------------------------
|
|
36
|
-
// Extended vehicle type schema for available slots
|
|
37
|
-
// ------------------------------
|
|
38
|
-
export const extendedVehicleTypeSchema = vehicleTypeSchema.extend({
|
|
39
|
-
code: z.string(),
|
|
40
|
-
height: z.string(),
|
|
41
|
-
surface_area_side: z.number(),
|
|
42
|
-
surface_aread_back: z.number(),
|
|
43
|
-
loading_duration: z.number()
|
|
44
|
-
});
|
|
51
|
+
.openapi('GetAvailableSlotsQuery');
|
|
45
52
|
// ------------------------------
|
|
46
53
|
// Response schemas
|
|
47
54
|
// ------------------------------
|
|
48
|
-
export const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
export const availableTimeSlotSchema = z
|
|
56
|
+
.object({
|
|
57
|
+
phase_slot_schedule_id: z.number().openapi({
|
|
58
|
+
description: 'Phase slot schedule ID',
|
|
59
|
+
example: 1
|
|
60
|
+
}),
|
|
61
|
+
date: z.string().openapi({
|
|
62
|
+
description: 'Date of the time slot (YYYY-MM-DD)',
|
|
63
|
+
example: '2026-06-15'
|
|
64
|
+
}),
|
|
65
|
+
start_time: z.string().openapi({
|
|
66
|
+
description: 'Start time of the slot (HH:MM)',
|
|
67
|
+
example: '08:00'
|
|
68
|
+
}),
|
|
69
|
+
end_time: z.string().openapi({
|
|
70
|
+
description: 'End time of the slot (HH:MM)',
|
|
71
|
+
example: '08:30'
|
|
72
|
+
}),
|
|
73
|
+
duration: z.number().openapi({
|
|
74
|
+
description: 'Duration in minutes',
|
|
75
|
+
example: 30
|
|
76
|
+
}),
|
|
77
|
+
schedule_type: z.enum(['assembly', 'dismantling']).openapi({
|
|
78
|
+
description: 'Type of schedule',
|
|
79
|
+
example: 'assembly'
|
|
80
|
+
}),
|
|
81
|
+
max_capacity: z.number().openapi({
|
|
82
|
+
description: 'Maximum booking capacity for this slot',
|
|
83
|
+
example: 5
|
|
84
|
+
}),
|
|
85
|
+
current_bookings: z.number().openapi({
|
|
86
|
+
description: 'Number of current bookings',
|
|
87
|
+
example: 3
|
|
88
|
+
}),
|
|
89
|
+
confirmed_bookings: z.number().openapi({
|
|
90
|
+
description: 'Number of confirmed bookings',
|
|
91
|
+
example: 1
|
|
92
|
+
}),
|
|
93
|
+
available_capacity: z.number().openapi({
|
|
94
|
+
description: 'Remaining available capacity',
|
|
95
|
+
example: 2
|
|
96
|
+
}),
|
|
97
|
+
is_available: z.boolean().openapi({
|
|
98
|
+
description: 'Whether the slot is available for booking',
|
|
99
|
+
example: true
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
.openapi('AvailableTimeSlot');
|
|
103
|
+
export const availableSlotsResponseSchema = z
|
|
104
|
+
.object({
|
|
105
|
+
event_id: z.number().openapi({
|
|
106
|
+
description: 'ID of the event',
|
|
107
|
+
example: 1
|
|
108
|
+
}),
|
|
109
|
+
event_code: z.string().openapi({
|
|
110
|
+
description: 'Code of the event',
|
|
111
|
+
example: 'COEC2025'
|
|
112
|
+
}),
|
|
113
|
+
event_name: z.string().openapi({
|
|
114
|
+
description: 'Name of the event',
|
|
115
|
+
example: 'COEC 2025'
|
|
116
|
+
}),
|
|
117
|
+
company_role: z.string().nullable().openapi({
|
|
118
|
+
description: 'Company role for the phase slots',
|
|
119
|
+
example: 'exhibitor'
|
|
120
|
+
}),
|
|
121
|
+
year: z.number().openapi({
|
|
122
|
+
description: 'Year of the slots',
|
|
123
|
+
example: 2026
|
|
124
|
+
}),
|
|
125
|
+
month: z.number().openapi({
|
|
126
|
+
description: 'Month of the slots',
|
|
127
|
+
example: 6
|
|
128
|
+
}),
|
|
129
|
+
available_slots: z.array(availableTimeSlotSchema).openapi({
|
|
130
|
+
description: 'List of available time slots with capacity information'
|
|
131
|
+
}),
|
|
132
|
+
total_slots: z.number().openapi({
|
|
133
|
+
description: 'Total number of time slots in the period',
|
|
134
|
+
example: 48
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
.openapi('AvailableSlotsResponse');
|
|
67
138
|
// ------------------------------
|
|
68
|
-
//
|
|
139
|
+
// Get Phase Slots by Event ID
|
|
69
140
|
// ------------------------------
|
|
70
|
-
export const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
141
|
+
export const getPhaseSlotsByEventIdParamsSchema = z
|
|
142
|
+
.object({
|
|
143
|
+
eventId: z
|
|
144
|
+
.string()
|
|
145
|
+
.min(1)
|
|
146
|
+
.transform(val => parseInt(val, 10))
|
|
147
|
+
.refine(val => !isNaN(val) && val > 0, {
|
|
148
|
+
message: 'Event ID must be a positive number'
|
|
149
|
+
})
|
|
150
|
+
.openapi({
|
|
151
|
+
description: 'The ID of the event',
|
|
152
|
+
example: '1'
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
.openapi('GetPhaseSlotsByEventIdParams');
|
|
156
|
+
export const phaseSlotItemSchema = z
|
|
157
|
+
.object({
|
|
158
|
+
id: z.number().openapi({
|
|
159
|
+
description: 'Phase slot ID',
|
|
160
|
+
example: 1
|
|
161
|
+
}),
|
|
162
|
+
event_id: z.number().openapi({
|
|
163
|
+
description: 'Event ID',
|
|
164
|
+
example: 1
|
|
165
|
+
}),
|
|
166
|
+
company_role: z.string().nullable().openapi({
|
|
167
|
+
description: 'Company role for this slot',
|
|
168
|
+
example: 'exhibitor'
|
|
169
|
+
}),
|
|
170
|
+
is_active: z.boolean().openapi({
|
|
171
|
+
description: 'Whether the slot is active',
|
|
172
|
+
example: true
|
|
173
|
+
}),
|
|
174
|
+
created_at: z.string().openapi({
|
|
175
|
+
description: 'Creation timestamp',
|
|
176
|
+
example: '2025-12-16T10:30:00Z'
|
|
177
|
+
}),
|
|
178
|
+
updated_at: z.string().openapi({
|
|
179
|
+
description: 'Last update timestamp',
|
|
180
|
+
example: '2025-12-16T10:30:00Z'
|
|
181
|
+
}),
|
|
182
|
+
created_by: z.string().nullable().openapi({
|
|
183
|
+
description: 'User ID who created the slot',
|
|
184
|
+
example: 'user-uuid-123'
|
|
185
|
+
}),
|
|
186
|
+
updated_by: z.string().nullable().openapi({
|
|
187
|
+
description: 'User ID who last updated the slot',
|
|
188
|
+
example: 'user-uuid-123'
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
.openapi('PhaseSlotItem');
|
|
192
|
+
export const getPhaseSlotsResponseSchema = z
|
|
193
|
+
.object({
|
|
194
|
+
event_id: z.number().openapi({
|
|
195
|
+
description: 'ID of the event',
|
|
196
|
+
example: 1
|
|
197
|
+
}),
|
|
198
|
+
slots: z.array(phaseSlotItemSchema).openapi({
|
|
199
|
+
description: 'List of phase slots for the event'
|
|
200
|
+
}),
|
|
201
|
+
total_count: z.number().openapi({
|
|
202
|
+
description: 'Total number of phase slots',
|
|
203
|
+
example: 10
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
.openapi('GetPhaseSlotsResponse');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venulog/phasing-engine-schemas",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
4
|
"description": "Shared schemas and types for Phasing Engine API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"./phaseSlot": {
|
|
30
30
|
"types": "./dist/phaseSlot.d.ts",
|
|
31
31
|
"import": "./dist/phaseSlot.js"
|
|
32
|
+
},
|
|
33
|
+
"./event": {
|
|
34
|
+
"types": "./dist/event.d.ts",
|
|
35
|
+
"import": "./dist/event.js"
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
"files": [
|