@voyantjs/availability 0.1.1 → 0.3.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.
- package/dist/routes-core.d.ts +851 -0
- package/dist/routes-core.d.ts.map +1 -0
- package/dist/routes-core.js +153 -0
- package/dist/routes-pickups.d.ts +1362 -0
- package/dist/routes-pickups.d.ts.map +1 -0
- package/dist/routes-pickups.js +264 -0
- package/dist/routes-shared.d.ts +49 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +45 -0
- package/dist/routes.d.ts +3 -2216
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +5 -540
- package/dist/service-core.d.ts +291 -0
- package/dist/service-core.d.ts.map +1 -0
- package/dist/service-core.js +205 -0
- package/dist/service-pickups.d.ts +407 -0
- package/dist/service-pickups.d.ts.map +1 -0
- package/dist/service-pickups.js +308 -0
- package/dist/service-shared.d.ts +45 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +12 -0
- package/dist/service.d.ts +57 -729
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +57 -517
- package/package.json +5 -5
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { and, asc, desc, eq, sql } from "drizzle-orm";
|
|
2
|
+
import { availabilityPickupPoints, availabilitySlotPickups, customPickupAreas, locationPickupTimes, pickupGroups, pickupLocations, productMeetingConfigs, } from "./schema.js";
|
|
3
|
+
import { paginate } from "./service-shared.js";
|
|
4
|
+
export async function listPickupPoints(db, query) {
|
|
5
|
+
const conditions = [];
|
|
6
|
+
if (query.productId)
|
|
7
|
+
conditions.push(eq(availabilityPickupPoints.productId, query.productId));
|
|
8
|
+
if (query.facilityId)
|
|
9
|
+
conditions.push(eq(availabilityPickupPoints.facilityId, query.facilityId));
|
|
10
|
+
if (query.active !== undefined)
|
|
11
|
+
conditions.push(eq(availabilityPickupPoints.active, query.active));
|
|
12
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
13
|
+
return paginate(db
|
|
14
|
+
.select()
|
|
15
|
+
.from(availabilityPickupPoints)
|
|
16
|
+
.where(where)
|
|
17
|
+
.limit(query.limit)
|
|
18
|
+
.offset(query.offset)
|
|
19
|
+
.orderBy(availabilityPickupPoints.createdAt), db.select({ count: sql `count(*)::int` }).from(availabilityPickupPoints).where(where), query.limit, query.offset);
|
|
20
|
+
}
|
|
21
|
+
export async function getPickupPointById(db, id) {
|
|
22
|
+
const [row] = await db
|
|
23
|
+
.select()
|
|
24
|
+
.from(availabilityPickupPoints)
|
|
25
|
+
.where(eq(availabilityPickupPoints.id, id))
|
|
26
|
+
.limit(1);
|
|
27
|
+
return row ?? null;
|
|
28
|
+
}
|
|
29
|
+
export async function createPickupPoint(db, data) {
|
|
30
|
+
const [row] = await db.insert(availabilityPickupPoints).values(data).returning();
|
|
31
|
+
return row;
|
|
32
|
+
}
|
|
33
|
+
export async function updatePickupPoint(db, id, data) {
|
|
34
|
+
const [row] = await db
|
|
35
|
+
.update(availabilityPickupPoints)
|
|
36
|
+
.set({ ...data, updatedAt: new Date() })
|
|
37
|
+
.where(eq(availabilityPickupPoints.id, id))
|
|
38
|
+
.returning();
|
|
39
|
+
return row ?? null;
|
|
40
|
+
}
|
|
41
|
+
export async function deletePickupPoint(db, id) {
|
|
42
|
+
const [row] = await db
|
|
43
|
+
.delete(availabilityPickupPoints)
|
|
44
|
+
.where(eq(availabilityPickupPoints.id, id))
|
|
45
|
+
.returning({ id: availabilityPickupPoints.id });
|
|
46
|
+
return row ?? null;
|
|
47
|
+
}
|
|
48
|
+
export async function listSlotPickups(db, query) {
|
|
49
|
+
const conditions = [];
|
|
50
|
+
if (query.slotId)
|
|
51
|
+
conditions.push(eq(availabilitySlotPickups.slotId, query.slotId));
|
|
52
|
+
if (query.pickupPointId) {
|
|
53
|
+
conditions.push(eq(availabilitySlotPickups.pickupPointId, query.pickupPointId));
|
|
54
|
+
}
|
|
55
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
56
|
+
return paginate(db
|
|
57
|
+
.select()
|
|
58
|
+
.from(availabilitySlotPickups)
|
|
59
|
+
.where(where)
|
|
60
|
+
.limit(query.limit)
|
|
61
|
+
.offset(query.offset)
|
|
62
|
+
.orderBy(availabilitySlotPickups.createdAt), db.select({ count: sql `count(*)::int` }).from(availabilitySlotPickups).where(where), query.limit, query.offset);
|
|
63
|
+
}
|
|
64
|
+
export async function getSlotPickupById(db, id) {
|
|
65
|
+
const [row] = await db
|
|
66
|
+
.select()
|
|
67
|
+
.from(availabilitySlotPickups)
|
|
68
|
+
.where(eq(availabilitySlotPickups.id, id))
|
|
69
|
+
.limit(1);
|
|
70
|
+
return row ?? null;
|
|
71
|
+
}
|
|
72
|
+
export async function createSlotPickup(db, data) {
|
|
73
|
+
const [row] = await db.insert(availabilitySlotPickups).values(data).returning();
|
|
74
|
+
return row;
|
|
75
|
+
}
|
|
76
|
+
export async function updateSlotPickup(db, id, data) {
|
|
77
|
+
const [row] = await db
|
|
78
|
+
.update(availabilitySlotPickups)
|
|
79
|
+
.set({ ...data, updatedAt: new Date() })
|
|
80
|
+
.where(eq(availabilitySlotPickups.id, id))
|
|
81
|
+
.returning();
|
|
82
|
+
return row ?? null;
|
|
83
|
+
}
|
|
84
|
+
export async function deleteSlotPickup(db, id) {
|
|
85
|
+
const [row] = await db
|
|
86
|
+
.delete(availabilitySlotPickups)
|
|
87
|
+
.where(eq(availabilitySlotPickups.id, id))
|
|
88
|
+
.returning({ id: availabilitySlotPickups.id });
|
|
89
|
+
return row ?? null;
|
|
90
|
+
}
|
|
91
|
+
export async function listMeetingConfigs(db, query) {
|
|
92
|
+
const conditions = [];
|
|
93
|
+
if (query.productId)
|
|
94
|
+
conditions.push(eq(productMeetingConfigs.productId, query.productId));
|
|
95
|
+
if (query.optionId)
|
|
96
|
+
conditions.push(eq(productMeetingConfigs.optionId, query.optionId));
|
|
97
|
+
if (query.facilityId)
|
|
98
|
+
conditions.push(eq(productMeetingConfigs.facilityId, query.facilityId));
|
|
99
|
+
if (query.mode)
|
|
100
|
+
conditions.push(eq(productMeetingConfigs.mode, query.mode));
|
|
101
|
+
if (query.active !== undefined)
|
|
102
|
+
conditions.push(eq(productMeetingConfigs.active, query.active));
|
|
103
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
104
|
+
return paginate(db
|
|
105
|
+
.select()
|
|
106
|
+
.from(productMeetingConfigs)
|
|
107
|
+
.where(where)
|
|
108
|
+
.limit(query.limit)
|
|
109
|
+
.offset(query.offset)
|
|
110
|
+
.orderBy(desc(productMeetingConfigs.updatedAt)), db.select({ count: sql `count(*)::int` }).from(productMeetingConfigs).where(where), query.limit, query.offset);
|
|
111
|
+
}
|
|
112
|
+
export async function getMeetingConfigById(db, id) {
|
|
113
|
+
const [row] = await db
|
|
114
|
+
.select()
|
|
115
|
+
.from(productMeetingConfigs)
|
|
116
|
+
.where(eq(productMeetingConfigs.id, id))
|
|
117
|
+
.limit(1);
|
|
118
|
+
return row ?? null;
|
|
119
|
+
}
|
|
120
|
+
export async function createMeetingConfig(db, data) {
|
|
121
|
+
const [row] = await db.insert(productMeetingConfigs).values(data).returning();
|
|
122
|
+
return row;
|
|
123
|
+
}
|
|
124
|
+
export async function updateMeetingConfig(db, id, data) {
|
|
125
|
+
const [row] = await db
|
|
126
|
+
.update(productMeetingConfigs)
|
|
127
|
+
.set({ ...data, updatedAt: new Date() })
|
|
128
|
+
.where(eq(productMeetingConfigs.id, id))
|
|
129
|
+
.returning();
|
|
130
|
+
return row ?? null;
|
|
131
|
+
}
|
|
132
|
+
export async function deleteMeetingConfig(db, id) {
|
|
133
|
+
const [row] = await db
|
|
134
|
+
.delete(productMeetingConfigs)
|
|
135
|
+
.where(eq(productMeetingConfigs.id, id))
|
|
136
|
+
.returning({ id: productMeetingConfigs.id });
|
|
137
|
+
return row ?? null;
|
|
138
|
+
}
|
|
139
|
+
export async function listPickupGroups(db, query) {
|
|
140
|
+
const conditions = [];
|
|
141
|
+
if (query.meetingConfigId)
|
|
142
|
+
conditions.push(eq(pickupGroups.meetingConfigId, query.meetingConfigId));
|
|
143
|
+
if (query.kind)
|
|
144
|
+
conditions.push(eq(pickupGroups.kind, query.kind));
|
|
145
|
+
if (query.active !== undefined)
|
|
146
|
+
conditions.push(eq(pickupGroups.active, query.active));
|
|
147
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
148
|
+
return paginate(db
|
|
149
|
+
.select()
|
|
150
|
+
.from(pickupGroups)
|
|
151
|
+
.where(where)
|
|
152
|
+
.limit(query.limit)
|
|
153
|
+
.offset(query.offset)
|
|
154
|
+
.orderBy(asc(pickupGroups.sortOrder), pickupGroups.createdAt), db.select({ count: sql `count(*)::int` }).from(pickupGroups).where(where), query.limit, query.offset);
|
|
155
|
+
}
|
|
156
|
+
export async function getPickupGroupById(db, id) {
|
|
157
|
+
const [row] = await db.select().from(pickupGroups).where(eq(pickupGroups.id, id)).limit(1);
|
|
158
|
+
return row ?? null;
|
|
159
|
+
}
|
|
160
|
+
export async function createPickupGroup(db, data) {
|
|
161
|
+
const [row] = await db.insert(pickupGroups).values(data).returning();
|
|
162
|
+
return row;
|
|
163
|
+
}
|
|
164
|
+
export async function updatePickupGroup(db, id, data) {
|
|
165
|
+
const [row] = await db
|
|
166
|
+
.update(pickupGroups)
|
|
167
|
+
.set({ ...data, updatedAt: new Date() })
|
|
168
|
+
.where(eq(pickupGroups.id, id))
|
|
169
|
+
.returning();
|
|
170
|
+
return row ?? null;
|
|
171
|
+
}
|
|
172
|
+
export async function deletePickupGroup(db, id) {
|
|
173
|
+
const [row] = await db
|
|
174
|
+
.delete(pickupGroups)
|
|
175
|
+
.where(eq(pickupGroups.id, id))
|
|
176
|
+
.returning({ id: pickupGroups.id });
|
|
177
|
+
return row ?? null;
|
|
178
|
+
}
|
|
179
|
+
export async function listPickupLocations(db, query) {
|
|
180
|
+
const conditions = [];
|
|
181
|
+
if (query.groupId)
|
|
182
|
+
conditions.push(eq(pickupLocations.groupId, query.groupId));
|
|
183
|
+
if (query.facilityId)
|
|
184
|
+
conditions.push(eq(pickupLocations.facilityId, query.facilityId));
|
|
185
|
+
if (query.active !== undefined)
|
|
186
|
+
conditions.push(eq(pickupLocations.active, query.active));
|
|
187
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
188
|
+
return paginate(db
|
|
189
|
+
.select()
|
|
190
|
+
.from(pickupLocations)
|
|
191
|
+
.where(where)
|
|
192
|
+
.limit(query.limit)
|
|
193
|
+
.offset(query.offset)
|
|
194
|
+
.orderBy(asc(pickupLocations.sortOrder), pickupLocations.createdAt), db.select({ count: sql `count(*)::int` }).from(pickupLocations).where(where), query.limit, query.offset);
|
|
195
|
+
}
|
|
196
|
+
export async function getPickupLocationById(db, id) {
|
|
197
|
+
const [row] = await db.select().from(pickupLocations).where(eq(pickupLocations.id, id)).limit(1);
|
|
198
|
+
return row ?? null;
|
|
199
|
+
}
|
|
200
|
+
export async function createPickupLocation(db, data) {
|
|
201
|
+
const [row] = await db.insert(pickupLocations).values(data).returning();
|
|
202
|
+
return row;
|
|
203
|
+
}
|
|
204
|
+
export async function updatePickupLocation(db, id, data) {
|
|
205
|
+
const [row] = await db
|
|
206
|
+
.update(pickupLocations)
|
|
207
|
+
.set({ ...data, updatedAt: new Date() })
|
|
208
|
+
.where(eq(pickupLocations.id, id))
|
|
209
|
+
.returning();
|
|
210
|
+
return row ?? null;
|
|
211
|
+
}
|
|
212
|
+
export async function deletePickupLocation(db, id) {
|
|
213
|
+
const [row] = await db
|
|
214
|
+
.delete(pickupLocations)
|
|
215
|
+
.where(eq(pickupLocations.id, id))
|
|
216
|
+
.returning({ id: pickupLocations.id });
|
|
217
|
+
return row ?? null;
|
|
218
|
+
}
|
|
219
|
+
export async function listLocationPickupTimes(db, query) {
|
|
220
|
+
const conditions = [];
|
|
221
|
+
if (query.pickupLocationId) {
|
|
222
|
+
conditions.push(eq(locationPickupTimes.pickupLocationId, query.pickupLocationId));
|
|
223
|
+
}
|
|
224
|
+
if (query.slotId)
|
|
225
|
+
conditions.push(eq(locationPickupTimes.slotId, query.slotId));
|
|
226
|
+
if (query.startTimeId)
|
|
227
|
+
conditions.push(eq(locationPickupTimes.startTimeId, query.startTimeId));
|
|
228
|
+
if (query.active !== undefined)
|
|
229
|
+
conditions.push(eq(locationPickupTimes.active, query.active));
|
|
230
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
231
|
+
return paginate(db
|
|
232
|
+
.select()
|
|
233
|
+
.from(locationPickupTimes)
|
|
234
|
+
.where(where)
|
|
235
|
+
.limit(query.limit)
|
|
236
|
+
.offset(query.offset)
|
|
237
|
+
.orderBy(locationPickupTimes.createdAt), db.select({ count: sql `count(*)::int` }).from(locationPickupTimes).where(where), query.limit, query.offset);
|
|
238
|
+
}
|
|
239
|
+
export async function getLocationPickupTimeById(db, id) {
|
|
240
|
+
const [row] = await db
|
|
241
|
+
.select()
|
|
242
|
+
.from(locationPickupTimes)
|
|
243
|
+
.where(eq(locationPickupTimes.id, id))
|
|
244
|
+
.limit(1);
|
|
245
|
+
return row ?? null;
|
|
246
|
+
}
|
|
247
|
+
export async function createLocationPickupTime(db, data) {
|
|
248
|
+
const [row] = await db.insert(locationPickupTimes).values(data).returning();
|
|
249
|
+
return row;
|
|
250
|
+
}
|
|
251
|
+
export async function updateLocationPickupTime(db, id, data) {
|
|
252
|
+
const [row] = await db
|
|
253
|
+
.update(locationPickupTimes)
|
|
254
|
+
.set({ ...data, updatedAt: new Date() })
|
|
255
|
+
.where(eq(locationPickupTimes.id, id))
|
|
256
|
+
.returning();
|
|
257
|
+
return row ?? null;
|
|
258
|
+
}
|
|
259
|
+
export async function deleteLocationPickupTime(db, id) {
|
|
260
|
+
const [row] = await db
|
|
261
|
+
.delete(locationPickupTimes)
|
|
262
|
+
.where(eq(locationPickupTimes.id, id))
|
|
263
|
+
.returning({ id: locationPickupTimes.id });
|
|
264
|
+
return row ?? null;
|
|
265
|
+
}
|
|
266
|
+
export async function listCustomPickupAreas(db, query) {
|
|
267
|
+
const conditions = [];
|
|
268
|
+
if (query.meetingConfigId) {
|
|
269
|
+
conditions.push(eq(customPickupAreas.meetingConfigId, query.meetingConfigId));
|
|
270
|
+
}
|
|
271
|
+
if (query.active !== undefined)
|
|
272
|
+
conditions.push(eq(customPickupAreas.active, query.active));
|
|
273
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
274
|
+
return paginate(db
|
|
275
|
+
.select()
|
|
276
|
+
.from(customPickupAreas)
|
|
277
|
+
.where(where)
|
|
278
|
+
.limit(query.limit)
|
|
279
|
+
.offset(query.offset)
|
|
280
|
+
.orderBy(customPickupAreas.createdAt), db.select({ count: sql `count(*)::int` }).from(customPickupAreas).where(where), query.limit, query.offset);
|
|
281
|
+
}
|
|
282
|
+
export async function getCustomPickupAreaById(db, id) {
|
|
283
|
+
const [row] = await db
|
|
284
|
+
.select()
|
|
285
|
+
.from(customPickupAreas)
|
|
286
|
+
.where(eq(customPickupAreas.id, id))
|
|
287
|
+
.limit(1);
|
|
288
|
+
return row ?? null;
|
|
289
|
+
}
|
|
290
|
+
export async function createCustomPickupArea(db, data) {
|
|
291
|
+
const [row] = await db.insert(customPickupAreas).values(data).returning();
|
|
292
|
+
return row;
|
|
293
|
+
}
|
|
294
|
+
export async function updateCustomPickupArea(db, id, data) {
|
|
295
|
+
const [row] = await db
|
|
296
|
+
.update(customPickupAreas)
|
|
297
|
+
.set({ ...data, updatedAt: new Date() })
|
|
298
|
+
.where(eq(customPickupAreas.id, id))
|
|
299
|
+
.returning();
|
|
300
|
+
return row ?? null;
|
|
301
|
+
}
|
|
302
|
+
export async function deleteCustomPickupArea(db, id) {
|
|
303
|
+
const [row] = await db
|
|
304
|
+
.delete(customPickupAreas)
|
|
305
|
+
.where(eq(customPickupAreas.id, id))
|
|
306
|
+
.returning({ id: customPickupAreas.id });
|
|
307
|
+
return row ?? null;
|
|
308
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { availabilityCloseoutListQuerySchema, availabilityPickupPointListQuerySchema, availabilityRuleListQuerySchema, availabilitySlotListQuerySchema, availabilitySlotPickupListQuerySchema, availabilityStartTimeListQuerySchema, customPickupAreaListQuerySchema, insertAvailabilityCloseoutSchema, insertAvailabilityPickupPointSchema, insertAvailabilityRuleSchema, insertAvailabilitySlotPickupSchema, insertAvailabilitySlotSchema, insertAvailabilityStartTimeSchema, insertCustomPickupAreaSchema, insertLocationPickupTimeSchema, insertPickupGroupSchema, insertPickupLocationSchema, insertProductMeetingConfigSchema, locationPickupTimeListQuerySchema, pickupGroupListQuerySchema, pickupLocationListQuerySchema, productMeetingConfigListQuerySchema, updateAvailabilityCloseoutSchema, updateAvailabilityPickupPointSchema, updateAvailabilityRuleSchema, updateAvailabilitySlotPickupSchema, updateAvailabilitySlotSchema, updateAvailabilityStartTimeSchema, updateCustomPickupAreaSchema, updateLocationPickupTimeSchema, updatePickupGroupSchema, updatePickupLocationSchema, updateProductMeetingConfigSchema } from "./validation.js";
|
|
3
|
+
export type AvailabilityRuleListQuery = z.infer<typeof availabilityRuleListQuerySchema>;
|
|
4
|
+
export type AvailabilityStartTimeListQuery = z.infer<typeof availabilityStartTimeListQuerySchema>;
|
|
5
|
+
export type AvailabilitySlotListQuery = z.infer<typeof availabilitySlotListQuerySchema>;
|
|
6
|
+
export type AvailabilityCloseoutListQuery = z.infer<typeof availabilityCloseoutListQuerySchema>;
|
|
7
|
+
export type AvailabilityPickupPointListQuery = z.infer<typeof availabilityPickupPointListQuerySchema>;
|
|
8
|
+
export type AvailabilitySlotPickupListQuery = z.infer<typeof availabilitySlotPickupListQuerySchema>;
|
|
9
|
+
export type ProductMeetingConfigListQuery = z.infer<typeof productMeetingConfigListQuerySchema>;
|
|
10
|
+
export type PickupGroupListQuery = z.infer<typeof pickupGroupListQuerySchema>;
|
|
11
|
+
export type PickupLocationListQuery = z.infer<typeof pickupLocationListQuerySchema>;
|
|
12
|
+
export type LocationPickupTimeListQuery = z.infer<typeof locationPickupTimeListQuerySchema>;
|
|
13
|
+
export type CustomPickupAreaListQuery = z.infer<typeof customPickupAreaListQuerySchema>;
|
|
14
|
+
export type CreateAvailabilityRuleInput = z.infer<typeof insertAvailabilityRuleSchema>;
|
|
15
|
+
export type UpdateAvailabilityRuleInput = z.infer<typeof updateAvailabilityRuleSchema>;
|
|
16
|
+
export type CreateAvailabilityStartTimeInput = z.infer<typeof insertAvailabilityStartTimeSchema>;
|
|
17
|
+
export type UpdateAvailabilityStartTimeInput = z.infer<typeof updateAvailabilityStartTimeSchema>;
|
|
18
|
+
export type CreateAvailabilitySlotInput = z.infer<typeof insertAvailabilitySlotSchema>;
|
|
19
|
+
export type UpdateAvailabilitySlotInput = z.infer<typeof updateAvailabilitySlotSchema>;
|
|
20
|
+
export type CreateAvailabilityCloseoutInput = z.infer<typeof insertAvailabilityCloseoutSchema>;
|
|
21
|
+
export type UpdateAvailabilityCloseoutInput = z.infer<typeof updateAvailabilityCloseoutSchema>;
|
|
22
|
+
export type CreateAvailabilityPickupPointInput = z.infer<typeof insertAvailabilityPickupPointSchema>;
|
|
23
|
+
export type UpdateAvailabilityPickupPointInput = z.infer<typeof updateAvailabilityPickupPointSchema>;
|
|
24
|
+
export type CreateAvailabilitySlotPickupInput = z.infer<typeof insertAvailabilitySlotPickupSchema>;
|
|
25
|
+
export type UpdateAvailabilitySlotPickupInput = z.infer<typeof updateAvailabilitySlotPickupSchema>;
|
|
26
|
+
export type CreateProductMeetingConfigInput = z.infer<typeof insertProductMeetingConfigSchema>;
|
|
27
|
+
export type UpdateProductMeetingConfigInput = z.infer<typeof updateProductMeetingConfigSchema>;
|
|
28
|
+
export type CreatePickupGroupInput = z.infer<typeof insertPickupGroupSchema>;
|
|
29
|
+
export type UpdatePickupGroupInput = z.infer<typeof updatePickupGroupSchema>;
|
|
30
|
+
export type CreatePickupLocationInput = z.infer<typeof insertPickupLocationSchema>;
|
|
31
|
+
export type UpdatePickupLocationInput = z.infer<typeof updatePickupLocationSchema>;
|
|
32
|
+
export type CreateLocationPickupTimeInput = z.infer<typeof insertLocationPickupTimeSchema>;
|
|
33
|
+
export type UpdateLocationPickupTimeInput = z.infer<typeof updateLocationPickupTimeSchema>;
|
|
34
|
+
export type CreateCustomPickupAreaInput = z.infer<typeof insertCustomPickupAreaSchema>;
|
|
35
|
+
export type UpdateCustomPickupAreaInput = z.infer<typeof updateCustomPickupAreaSchema>;
|
|
36
|
+
export declare function paginate<T extends object>(rowsQuery: Promise<T[]>, countQuery: Promise<Array<{
|
|
37
|
+
count: number;
|
|
38
|
+
}>>, limit: number, offset: number): Promise<{
|
|
39
|
+
data: T[];
|
|
40
|
+
total: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
offset: number;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function toDateOrNull(value: string | null | undefined): Date | null;
|
|
45
|
+
//# sourceMappingURL=service-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-shared.d.ts","sourceRoot":"","sources":["../src/service-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EACV,mCAAmC,EACnC,sCAAsC,EACtC,+BAA+B,EAC/B,+BAA+B,EAC/B,qCAAqC,EACrC,oCAAoC,EACpC,+BAA+B,EAC/B,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,iCAAiC,EACjC,4BAA4B,EAC5B,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,EAC1B,gCAAgC,EAChC,iCAAiC,EACjC,0BAA0B,EAC1B,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,EAChC,mCAAmC,EACnC,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,iCAAiC,EACjC,4BAA4B,EAC5B,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,iBAAi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C,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAC1F,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAC1F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACtF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEtF,wBAAsB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAC7C,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EACvB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAC7C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;GAUf;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,eAE5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export async function paginate(rowsQuery, countQuery, limit, offset) {
|
|
2
|
+
const [data, countResult] = await Promise.all([rowsQuery, countQuery]);
|
|
3
|
+
return {
|
|
4
|
+
data,
|
|
5
|
+
total: countResult[0]?.count ?? 0,
|
|
6
|
+
limit,
|
|
7
|
+
offset,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function toDateOrNull(value) {
|
|
11
|
+
return value ? new Date(value) : null;
|
|
12
|
+
}
|