From 38b0b6257357706b755e39cc0a68f7e784b82a41 Mon Sep 17 00:00:00 2001 From: Stefan Ivanov Date: Thu, 2 Nov 2023 19:53:42 +0100 Subject: [PATCH] Use Appointment Booking API V3 --- .../backend/src/common/optimisation-api.dao.ts | 13 +++++++------ .../slot-booking/services/slot-booking.service.ts | 2 +- .../app/slot-booking/slot-booking.component.html | 6 +++--- .../src/app/slot-booking/slot-booking.component.ts | 4 +++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/workbench/backend/src/common/optimisation-api.dao.ts b/workbench/backend/src/common/optimisation-api.dao.ts index 516182b..c69aeae 100644 --- a/workbench/backend/src/common/optimisation-api.dao.ts +++ b/workbench/backend/src/common/optimisation-api.dao.ts @@ -15,14 +15,15 @@ export type SearchRequest = Readonly<{ udfValues: { [key: string]: string; } - }>; slots: ISearchRequestSlot[]; + }>; + slots: ISearchRequestSlot[]; resources: { personIds: string[] }, options: Readonly<{ maxResultsPerSlot: number; }>; - optimizationPlugin: null | string; + policy: null | string; }>; export type ReOptimizeRequest = Readonly<{ @@ -117,11 +118,11 @@ export class OptimisationAPIDAO { tap(response => { try { const elapsedMilliseconds: number = new Date().getTime() - requestStart.getTime(); - console.debug( - `[OptimisationAPIDAO:${config.method}] url: [${config.url}] response: [${JSON.stringify(response ? response.status : null)}], time: [${elapsedMilliseconds}]`, + console.info( + `[OptimisationAPIDAO:${config.method}] url: [${config.url}] response: [${JSON.stringify(response ? response.request : null)}], time: [${elapsedMilliseconds}]`, ); } catch { - console.debug(`[OptimisationAPIDAO:${config.method}] url: [${config.url}] response[UNPROCESSIBLE]`); + console.info(`[OptimisationAPIDAO:${config.method}] url: [${config.url}] response[UNPROCESSIBLE]`); } }), catchError((error: AxiosError) => { @@ -134,7 +135,7 @@ export class OptimisationAPIDAO { public slotsSearch(ctx: Context, data: SearchRequest) { return this.request({ method: 'POST', - url: `${this.resolveHost(ctx.cloudHost)}/optimization/api/v2/job-slots/actions/search`, + url: `${this.resolveHost(ctx.cloudHost)}/optimization/api/v3/job-slots/actions/search`, headers: this.getHeaders(ctx), params: this.getParams(ctx), responseType: 'json', diff --git a/workbench/frontend/src/app/slot-booking/services/slot-booking.service.ts b/workbench/frontend/src/app/slot-booking/services/slot-booking.service.ts index 28e039f..a27b4f6 100644 --- a/workbench/frontend/src/app/slot-booking/services/slot-booking.service.ts +++ b/workbench/frontend/src/app/slot-booking/services/slot-booking.service.ts @@ -65,7 +65,7 @@ export type SearchRequest = Readonly<{ options: Readonly<{ maxResultsPerSlot: number; }>; - optimizationPlugin: null | string; + policy: null | string; }>; type ILocation = { latitude: number; diff --git a/workbench/frontend/src/app/slot-booking/slot-booking.component.html b/workbench/frontend/src/app/slot-booking/slot-booking.component.html index 0faf4d3..f3543e8 100644 --- a/workbench/frontend/src/app/slot-booking/slot-booking.component.html +++ b/workbench/frontend/src/app/slot-booking/slot-booking.component.html @@ -111,10 +111,10 @@

Response

search Search for slots - using /api/v2/job-slots/actions/search Search Job Slot API see + using /api/v3/job-slots/actions/search Search Job Slot API see + href="https://eu.coresystems.net/optimization/api/v1/swagger-ui/#/Search%20Job%20Slot/post_api_v3_job_slots_actions_search"> documentation @@ -172,7 +172,7 @@

Slot Search Options:

🤖  How / AI-Plugin - {{ (requestPayload$ | async)?.optimizationPlugin }} + {{ (requestPayload$ | async)?.policy }} diff --git a/workbench/frontend/src/app/slot-booking/slot-booking.component.ts b/workbench/frontend/src/app/slot-booking/slot-booking.component.ts index 8fbcba3..61defe2 100644 --- a/workbench/frontend/src/app/slot-booking/slot-booking.component.ts +++ b/workbench/frontend/src/app/slot-booking/slot-booking.component.ts @@ -80,7 +80,7 @@ export class SlotBookingComponent implements OnInit, OnDestroy { maxResultsPerSlot: 8 }, - optimizationPlugin: pluginEditor, + policy: pluginEditor, } }) @@ -129,6 +129,8 @@ export class SlotBookingComponent implements OnInit, OnDestroy { take(1), mergeMap(payload => { + console.log(payload); + // options here return this.service.doRequest(payload).pipe(