Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Appointment Booking API V3 #75

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading