feat(api): Added connection to the dotnet api (TV-189)
Squashed commit of the following:
commit 6f06bf69b87c77473c21fbe5fcc5669964793b17
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 15:01:16 2021 +0200
Fixed issue with including qp insde breadcrumbs
commit 579b6105acc7a60864f07b6082329872a2105bd3
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 14:46:54 2021 +0200
Added some more data to the mock-api and fixed navigation-bar
commit f9b820136017584655fadafaf716155aec85316e
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 10:11:55 2021 +0200
Updated mock-api
commit 5367d2a475b1c0b8807cf5a9c3f8987b3a586de4
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 19 16:00:07 2021 +0200
Added different config for dotnet api
commit 47de5b8ad7c0924c82f07568aa2a4386613e3bd6
Merge: 22d5e9a dc40953
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 19 07:54:55 2021 +0200
Merged develop
commit 22d5e9a126e3c1237531407ec3e6d47fbfea55e8
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 12 11:48:25 2021 +0200
Added new configuration to talk with local API
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { mapPegaAccessGroupToAccessGroups, PegaAccessGroup } from '@dafa-enums/access-group.enum';
|
||||
import { Agency } from '@dafa-models/agency.model';
|
||||
import { mapPegaAuthorizationToAuthorization, PegaAuthorization } from '@dafa-enums/authorization.enum';
|
||||
import { Service } from '@dafa-enums/service.enum';
|
||||
import { Participant } from './participant.model';
|
||||
import { User } from './user.model';
|
||||
import { User, UserApiResponse } from './user.model';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface Employee extends User {
|
||||
@@ -10,12 +10,19 @@ export interface Employee extends User {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}[];
|
||||
ssn: string;
|
||||
agencies: Agency[];
|
||||
participants: Participant[];
|
||||
services: Service[];
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
export interface EmployeeApiResponse extends UserApiResponse {
|
||||
active: boolean;
|
||||
services: Service[];
|
||||
languages: string[];
|
||||
participants: Participant[];
|
||||
}
|
||||
|
||||
export interface EmployeesApiResponse {
|
||||
export interface PegaEmployeesApiResponse {
|
||||
pxMore: string;
|
||||
pxObjClass: string;
|
||||
pxPageCount: string;
|
||||
@@ -24,11 +31,11 @@ export interface EmployeesApiResponse {
|
||||
pxTotalResultCount: string;
|
||||
pyMaxRecords: string;
|
||||
pyObjClass: string;
|
||||
pxResults: EmployeeApiResponse[];
|
||||
pxResults: PegaEmployeeApiResponse[];
|
||||
pzPerformanceSettings: string[];
|
||||
}
|
||||
|
||||
export interface EmployeeApiResponse {
|
||||
export interface PegaEmployeeApiResponse {
|
||||
pxInsHandle: string;
|
||||
pxObjClass: string;
|
||||
pyAccessGroup: string;
|
||||
@@ -42,13 +49,13 @@ export interface EmployeeApiResponse {
|
||||
pyUserName: string;
|
||||
}
|
||||
|
||||
export interface EmployeeApiRequestData {
|
||||
export interface PegaEmployeeApiRequestData {
|
||||
pyFirstName: string;
|
||||
pyLastName: string;
|
||||
pyTelephone: string;
|
||||
}
|
||||
|
||||
export interface EmployeeApiPostResponse {
|
||||
export interface PegaEmployeeApiPostResponse {
|
||||
pxObjClass: string;
|
||||
pyErrorMessage: string;
|
||||
pyFirstName: string;
|
||||
@@ -58,7 +65,7 @@ export interface EmployeeApiPostResponse {
|
||||
pyUserIdentifier: string;
|
||||
}
|
||||
|
||||
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
|
||||
export function mapEmployeeToEmployeeApiRequestData(data: Employee): PegaEmployeeApiRequestData {
|
||||
return {
|
||||
pyFirstName: data.firstName,
|
||||
pyLastName: data.lastName,
|
||||
@@ -66,24 +73,65 @@ export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApi
|
||||
};
|
||||
}
|
||||
|
||||
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
||||
export function mapPegaEmployeeReponseToEmployee(data: PegaEmployeeApiResponse): Employee {
|
||||
return {
|
||||
id: data.pyUserIdentifier,
|
||||
lastName: data.pyLastName,
|
||||
firstName: data.pyFirstName,
|
||||
fullName: `${data.pyFirstName} ${data.pyLastName}`,
|
||||
organization: data.pyOrganization,
|
||||
organizationDivision: data.pyOrgDivision,
|
||||
organizationUnit: data.pyOrgUnit,
|
||||
organization: {
|
||||
id: '',
|
||||
name: data.pyOrganization,
|
||||
kaNumber: null,
|
||||
address: {
|
||||
street: null,
|
||||
houseNumber: null,
|
||||
postalCode: null,
|
||||
city: null,
|
||||
kommun: null,
|
||||
},
|
||||
},
|
||||
phone: data.pyTelephone,
|
||||
email: '',
|
||||
accessGroups: mapPegaAccessGroupToAccessGroups(data.pyAccessGroup as PegaAccessGroup),
|
||||
utforandeverksamhet: '',
|
||||
service: '',
|
||||
authorizations: mapPegaAuthorizationToAuthorization(data.pyAccessGroup as PegaAuthorization),
|
||||
services: [],
|
||||
languages: [],
|
||||
outOfOffice: null,
|
||||
ssn: '',
|
||||
agencies: [],
|
||||
participants: [],
|
||||
active: true,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
||||
const {
|
||||
id,
|
||||
firstName,
|
||||
lastName,
|
||||
phone,
|
||||
email,
|
||||
ssn,
|
||||
active,
|
||||
services,
|
||||
languages,
|
||||
organization,
|
||||
authorizations,
|
||||
participants,
|
||||
} = data;
|
||||
return {
|
||||
id,
|
||||
firstName,
|
||||
lastName,
|
||||
fullName: `${firstName} ${lastName}`,
|
||||
organization,
|
||||
phone,
|
||||
email,
|
||||
authorizations,
|
||||
services,
|
||||
languages,
|
||||
outOfOffice: null,
|
||||
ssn,
|
||||
participants,
|
||||
active,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user