@natch-the-storage/heathershaw-platform-types 1.11.2 → 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.
@@ -282,6 +282,13 @@ export type PatientRecordCreate = Omit<PatientRecord, 'id'>;
282
282
  export type PatientRecordUpdate = Partial<PatientRecord> & {
283
283
  id: number;
284
284
  };
285
+ export type PatientRecordOnboard = {
286
+ firstName: string;
287
+ lastName: string;
288
+ dateOfBirth: string;
289
+ phoneNumber: string;
290
+ addresses: Address[];
291
+ };
285
292
  export interface PriceMatch {
286
293
  id: number;
287
294
  partnerPharmacyProfileId: number;
@@ -639,6 +646,10 @@ export declare const BucketObjects: {
639
646
  };
640
647
  };
641
648
  };
649
+ interface ListParams {
650
+ page?: number;
651
+ limit?: number;
652
+ }
642
653
  export declare const ApiRoutes: {
643
654
  admin: {
644
655
  getDashboardData: string;
@@ -676,13 +687,11 @@ export declare const ApiRoutes: {
676
687
  createPaymentLink: string;
677
688
  };
678
689
  orders: {
679
- list: (filters?: {
690
+ list: (filters?: ListParams & {
680
691
  partnerPharmacyProfileId?: number;
681
692
  directUserProfileId?: number;
682
693
  patientRecordId?: number;
683
694
  draft?: boolean;
684
- page?: number;
685
- limit?: number;
686
695
  }) => string;
687
696
  get: (id: number) => string;
688
697
  getSummary: (date: string) => string;
@@ -718,7 +727,9 @@ export declare const ApiRoutes: {
718
727
  delete: (id: number) => string;
719
728
  };
720
729
  priceMatches: {
721
- list: string;
730
+ list: (filters?: {
731
+ partnerPharmacyProfileId?: number;
732
+ }) => string;
722
733
  get: (id: number) => string;
723
734
  create: string;
724
735
  update: string;
@@ -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: '/api/price-matches',
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natch-the-storage/heathershaw-platform-types",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "Interfaces and routes to use on the client",
5
5
  "license": "ISC",
6
6
  "author": "Natch Surana",