@natch-the-storage/heathershaw-platform-types 1.11.3 → 1.11.4
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/build/validators.d.ts +8 -4
- package/build/validators.js +14 -38
- package/package.json +1 -1
package/build/validators.d.ts
CHANGED
|
@@ -646,6 +646,10 @@ export declare const BucketObjects: {
|
|
|
646
646
|
};
|
|
647
647
|
};
|
|
648
648
|
};
|
|
649
|
+
interface ListParams {
|
|
650
|
+
page?: number;
|
|
651
|
+
limit?: number;
|
|
652
|
+
}
|
|
649
653
|
export declare const ApiRoutes: {
|
|
650
654
|
admin: {
|
|
651
655
|
getDashboardData: string;
|
|
@@ -683,13 +687,11 @@ export declare const ApiRoutes: {
|
|
|
683
687
|
createPaymentLink: string;
|
|
684
688
|
};
|
|
685
689
|
orders: {
|
|
686
|
-
list: (filters?: {
|
|
690
|
+
list: (filters?: ListParams & {
|
|
687
691
|
partnerPharmacyProfileId?: number;
|
|
688
692
|
directUserProfileId?: number;
|
|
689
693
|
patientRecordId?: number;
|
|
690
694
|
draft?: boolean;
|
|
691
|
-
page?: number;
|
|
692
|
-
limit?: number;
|
|
693
695
|
}) => string;
|
|
694
696
|
get: (id: number) => string;
|
|
695
697
|
getSummary: (date: string) => string;
|
|
@@ -725,7 +727,9 @@ export declare const ApiRoutes: {
|
|
|
725
727
|
delete: (id: number) => string;
|
|
726
728
|
};
|
|
727
729
|
priceMatches: {
|
|
728
|
-
list:
|
|
730
|
+
list: (filters?: {
|
|
731
|
+
partnerPharmacyProfileId?: number;
|
|
732
|
+
}) => string;
|
|
729
733
|
get: (id: number) => string;
|
|
730
734
|
create: string;
|
|
731
735
|
update: string;
|
package/build/validators.js
CHANGED
|
@@ -153,6 +153,16 @@ export const BucketObjects = {
|
|
|
153
153
|
},
|
|
154
154
|
},
|
|
155
155
|
};
|
|
156
|
+
function handleParams(filters) {
|
|
157
|
+
const params = new URLSearchParams();
|
|
158
|
+
const entries = Object.entries(filters ?? {});
|
|
159
|
+
for (const [key, value] of entries) {
|
|
160
|
+
if (value !== undefined && value !== null)
|
|
161
|
+
params.set(key, String(value));
|
|
162
|
+
}
|
|
163
|
+
const query = params.toString();
|
|
164
|
+
return `${query ? `?${query}` : ''}`;
|
|
165
|
+
}
|
|
156
166
|
export const ApiRoutes = {
|
|
157
167
|
admin: {
|
|
158
168
|
getDashboardData: '/api/admin/dashboard-data',
|
|
@@ -190,23 +200,7 @@ export const ApiRoutes = {
|
|
|
190
200
|
createPaymentLink: '/api/notifications/payment-links',
|
|
191
201
|
},
|
|
192
202
|
orders: {
|
|
193
|
-
list: (filters) => {
|
|
194
|
-
const params = new URLSearchParams();
|
|
195
|
-
if (filters?.partnerPharmacyProfileId)
|
|
196
|
-
params.set('partnerPharmacyProfileId', String(filters.partnerPharmacyProfileId));
|
|
197
|
-
if (filters?.directUserProfileId)
|
|
198
|
-
params.set('directUserProfileId', String(filters.directUserProfileId));
|
|
199
|
-
if (filters?.patientRecordId)
|
|
200
|
-
params.set('patientRecordId', String(filters.patientRecordId));
|
|
201
|
-
if (filters?.page)
|
|
202
|
-
params.set('page', String(filters.page));
|
|
203
|
-
if (filters?.limit)
|
|
204
|
-
params.set('limit', String(filters.limit));
|
|
205
|
-
if (filters?.draft)
|
|
206
|
-
params.set('draft', String(filters.draft));
|
|
207
|
-
const query = params.toString();
|
|
208
|
-
return `/api/orders${query ? `?${query}` : ''}`;
|
|
209
|
-
},
|
|
203
|
+
list: (filters) => `/api/orders${handleParams(filters)}`,
|
|
210
204
|
get: (id) => `/api/orders/${id}`,
|
|
211
205
|
getSummary: (date) => `/api/orders/summary${date ? '?date=' + date : ''}`,
|
|
212
206
|
create: '/api/orders',
|
|
@@ -241,7 +235,7 @@ export const ApiRoutes = {
|
|
|
241
235
|
delete: (id) => `/api/patient-records/${id}`,
|
|
242
236
|
},
|
|
243
237
|
priceMatches: {
|
|
244
|
-
list:
|
|
238
|
+
list: (filters) => `/api/price-matches${handleParams(filters)}`,
|
|
245
239
|
get: (id) => `/api/price-matches/${id}`,
|
|
246
240
|
create: '/api/price-matches',
|
|
247
241
|
update: '/api/price-matches',
|
|
@@ -263,15 +257,7 @@ export const ApiRoutes = {
|
|
|
263
257
|
delete: (id) => `/api/reminders/repeats/${id}`,
|
|
264
258
|
},
|
|
265
259
|
scripts: {
|
|
266
|
-
get: (filters) => {
|
|
267
|
-
const params = new URLSearchParams();
|
|
268
|
-
if (filters?.partnerPharmacyProfileId)
|
|
269
|
-
params.set('partnerPharmacyProfileId', String(filters.partnerPharmacyProfileId));
|
|
270
|
-
if (filters?.patientRecordId)
|
|
271
|
-
params.set('patientRecordId', String(filters.patientRecordId));
|
|
272
|
-
const query = params.toString();
|
|
273
|
-
return `/api/scripts${query ? `?${query}` : ''}`;
|
|
274
|
-
},
|
|
260
|
+
get: (filters) => `/api/scripts${handleParams(filters)}`,
|
|
275
261
|
getById: (id) => `/api/scripts/${id}`,
|
|
276
262
|
getAdminScripts: '/api/scripts/admin-scripts',
|
|
277
263
|
createEscript: '/api/scripts/escripts',
|
|
@@ -284,17 +270,7 @@ export const ApiRoutes = {
|
|
|
284
270
|
send: '/api/reminders/sms',
|
|
285
271
|
},
|
|
286
272
|
staffProfiles: {
|
|
287
|
-
list: (filters) => {
|
|
288
|
-
const params = new URLSearchParams();
|
|
289
|
-
if (filters?.userId)
|
|
290
|
-
params.set('userId', filters.userId);
|
|
291
|
-
if (filters?.page)
|
|
292
|
-
params.set('page', String(filters.page));
|
|
293
|
-
if (filters?.limit)
|
|
294
|
-
params.set('limit', String(filters.limit));
|
|
295
|
-
const query = params.toString();
|
|
296
|
-
return `/api/profiles/staff-profiles${query ? `?${query}` : ''}`;
|
|
297
|
-
},
|
|
273
|
+
list: (filters) => `/api/profiles/staff-profiles${handleParams(filters)}`,
|
|
298
274
|
get: (id) => `/api/profiles/staff-profiles/${id}`,
|
|
299
275
|
getByUser: (userId) => `/api/profiles/staff-profiles/users/${userId}`,
|
|
300
276
|
create: '/api/profiles/staff-profiles',
|