pha-hermes 1.13.0 → 1.14.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.
@@ -9,13 +9,31 @@ export class SFWorkorderClient {
9
9
  this.axiosInstance = axiosInstance
10
10
  }
11
11
 
12
-
13
- async getWorkordersForPractitioner(practitionerId?: string): Promise<Workorder[]> {
12
+ async getWorkordersForPractitioner(
13
+ practitionerId?: string,
14
+ options?: { startDate?: Date; endDate?: Date; provinces?: string[] }
15
+ ): Promise<Workorder[]> {
14
16
  try {
17
+ const filters: string[] = []
18
+ if (practitionerId) {
19
+ filters.push(`Personnel__c = '${practitionerId}'`)
20
+ }
21
+ if (options?.startDate) {
22
+ const isoStart = options.startDate.toISOString().split('T')[0]
23
+ filters.push(`EndDate__c >= ${isoStart}`)
24
+ }
25
+ if (options?.endDate) {
26
+ const isoEnd = options.endDate.toISOString().split('T')[0]
27
+ filters.push(`startdate__c <= ${isoEnd}`)
28
+ }
29
+
30
+ if (options?.provinces?.length) {
31
+ const provincesList = options?.provinces?.map(p => `'${p}'`).join(', ')
32
+ filters.push(`Region__c IN (${provincesList})`)
33
+ }
34
+ const whereClause = filters.length ? `WHERE ${filters.join(' AND ')}` : ''
15
35
  const url = `/services/data/${SF_API_VERSION}/query`
16
- const query = practitionerId
17
- ? `SELECT Id, Region__c, Name, HospitalID__c, HospitalName__c, ProfessionalDesignation__c, Personnel__c, startdate__c, EndDate__c, CreatedDate, LastModifiedDate FROM WorkOrder__c WHERE Personnel__c = '${practitionerId}'`
18
- : `SELECT Id, Region__c, Name, HospitalID__c, HospitalName__c, ProfessionalDesignation__c, Personnel__c, startdate__c, EndDate__c, CreatedDate, LastModifiedDate FROM WorkOrder__c`
36
+ const query = `SELECT Id, Region__c, Name, HospitalID__c, HospitalName__c, ProfessionalDesignation__c, Personnel__c, startdate__c, EndDate__c, CreatedDate, LastModifiedDate FROM WorkOrder__c ${whereClause}`
19
37
  return await this.axiosInstance
20
38
  .get(url, {
21
39
  params: { q: query }
@@ -42,4 +60,4 @@ export class SFWorkorderClient {
42
60
  throw error
43
61
  }
44
62
  }
45
- }
63
+ }
package/src/index.ts CHANGED
@@ -3,3 +3,6 @@ export { SFPractitionerClient } from './api/practitioner/practitionerClient'
3
3
  export { SFTimesheetClient } from './api/timesheet/timesheetClient'
4
4
  export { SFAuthenticator } from './api/auth/auth'
5
5
  export { Practitioner, Role, TimesheetDayEntry, Workorder } from './models'
6
+ export { LipheApiClient } from './api/lipheApiClient'
7
+ export { LipheAuthenticator } from './api/liphe1.0/auth/authClient'
8
+ export { LiphePractitionerClient } from './api/liphe1.0/practitioner/practitionerClient'