Skip to content

Commit

Permalink
Use Appointment Booking API V3
Browse files Browse the repository at this point in the history
  • Loading branch information
4effo committed Nov 2, 2023
1 parent 9f226c9 commit 38b0b62
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
13 changes: 7 additions & 6 deletions workbench/backend/src/common/optimisation-api.dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down Expand Up @@ -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) => {
Expand All @@ -134,7 +135,7 @@ export class OptimisationAPIDAO {
public slotsSearch(ctx: Context, data: SearchRequest) {
return this.request<SearchResponse>({
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type SearchRequest = Readonly<{
options: Readonly<{
maxResultsPerSlot: number;
}>;
optimizationPlugin: null | string;
policy: null | string;
}>;
type ILocation = {
latitude: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ <h2>Response</h2>
<mat-icon>search</mat-icon> Search for slots
</button>

using <mat-chip>/api/v2/job-slots/actions/search</mat-chip> Search Job Slot API see
using <mat-chip>/api/v3/job-slots/actions/search</mat-chip> Search Job Slot API see

<a target="_blank" style="margin-top: 15px;"
href="https://eu.coresystems.net/optimization/api/v1/swagger-ui/#/Search%20Job%20Slot/post_api_v2_job_slots_actions_search">
href="https://eu.coresystems.net/optimization/api/v1/swagger-ui/#/Search%20Job%20Slot/post_api_v3_job_slots_actions_search">
documentation
</a>

Expand Down Expand Up @@ -172,7 +172,7 @@ <h2 class="margin-10">Slot Search Options:</h2>
<mat-expansion-panel-header>
<mat-panel-title>
<strong class="panel-title">🤖&nbsp;&nbsp;How / AI-Plugin</strong>
<mat-chip class="panel-title-chip">{{ (requestPayload$ | async)?.optimizationPlugin }}</mat-chip>
<mat-chip class="panel-title-chip">{{ (requestPayload$ | async)?.policy }}</mat-chip>
</mat-panel-title>
<mat-panel-description></mat-panel-description>
</mat-expansion-panel-header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class SlotBookingComponent implements OnInit, OnDestroy {
maxResultsPerSlot: 8
},

optimizationPlugin: pluginEditor,
policy: pluginEditor,

}
})
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 38b0b62

Please sign in to comment.