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.
- package/dist/api/liphe1.0/auth/authClient.d.ts +13 -0
- package/dist/api/liphe1.0/practitioner/practitionerClient.d.ts +13 -0
- package/dist/api/lipheApiClient.d.ts +13 -0
- package/dist/api/timesheet/timesheetClient.d.ts +24 -4
- package/dist/api/workorder/workorderClient.d.ts +5 -1
- package/dist/index.d.ts +3 -0
- package/dist/pha-hermes.cjs.development.js +340 -155
- package/dist/pha-hermes.cjs.development.js.map +1 -1
- package/dist/pha-hermes.cjs.production.min.js +1 -1
- package/dist/pha-hermes.cjs.production.min.js.map +1 -1
- package/dist/pha-hermes.esm.js +338 -156
- package/dist/pha-hermes.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/liphe1.0/auth/authClient.ts +76 -0
- package/src/api/liphe1.0/practitioner/practitionerClient.ts +49 -0
- package/src/api/lipheApiClient.ts +38 -0
- package/src/api/timesheet/timesheetClient.ts +54 -50
- package/src/api/workorder/workorderClient.ts +24 -6
- package/src/index.ts +3 -0
|
@@ -9,13 +9,31 @@ export class SFWorkorderClient {
|
|
|
9
9
|
this.axiosInstance = axiosInstance
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
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 =
|
|
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'
|