Merge pull request #14 in TEA/dafa-web-monorepo from feature/more-mock-api-fixes to develop
Squashed commit of the following: commit 9473ca4e23eb6c5967d9df3403cc071d48e0ab73 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Jun 1 08:18:39 2021 +0200 Adding footer commit 8f13809ad3928fd09fd67d713a61c2ca4ef27bc4 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Tue Jun 1 06:57:34 2021 +0200 Added footer commit ee8a5be048786843e3c5672368a0663ead424852 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Mon May 31 16:07:14 2021 +0200 Added size to edit icon commit b8e99713bc0190075cfe201f8cd515dca78e184e Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Mon May 24 15:54:15 2021 +0200 Renamed create account to employee form and fixed some validation commit 935509bc5dd6bc7f6533b580197da2f8c15affc3 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Mon May 24 08:28:40 2021 +0200 More changes to mock-api and views commit d0bb8e1c0130c996ee89413f5ddda015fcf49ec5 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Fri May 21 11:22:40 2021 +0200 Modified mock-api and implemented a part inside employee-list
This commit is contained in:
@@ -1,27 +1,22 @@
|
||||
import { mapPegaAuthorizationToAuthorization, PegaAuthorization } from '@dafa-enums/authorization.enum';
|
||||
import { Service } from '@dafa-enums/service.enum';
|
||||
import { Participant } from './participant.model';
|
||||
import { Service } from './service.model';
|
||||
import { User, UserApiResponse } from './user.model';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface Employee extends User {
|
||||
languages: string[];
|
||||
outOfOffice: {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}[];
|
||||
participants: Participant[];
|
||||
services: Service[];
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
export interface EmployeeApiResponse extends UserApiResponse {
|
||||
active: boolean;
|
||||
services: Service[];
|
||||
languages: string[];
|
||||
participants: Participant[];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface EmployeeApiRequestData extends Employee {}
|
||||
|
||||
export interface PegaEmployeesApiResponse {
|
||||
pxMore: string;
|
||||
pxObjClass: string;
|
||||
@@ -44,7 +39,6 @@ export interface PegaEmployeeApiResponse {
|
||||
pyOrganization: string;
|
||||
pyOrgDivision: string;
|
||||
pyOrgUnit: string;
|
||||
pyTelephone: string;
|
||||
pyUserIdentifier: string;
|
||||
pyUserName: string;
|
||||
}
|
||||
@@ -52,7 +46,6 @@ export interface PegaEmployeeApiResponse {
|
||||
export interface PegaEmployeeApiRequestData {
|
||||
pyFirstName: string;
|
||||
pyLastName: string;
|
||||
pyTelephone: string;
|
||||
}
|
||||
|
||||
export interface PegaEmployeeApiPostResponse {
|
||||
@@ -61,15 +54,17 @@ export interface PegaEmployeeApiPostResponse {
|
||||
pyFirstName: string;
|
||||
pyHasError: 'true' | 'false';
|
||||
pyLastName: string;
|
||||
pyTelephone: string;
|
||||
pyUserIdentifier: string;
|
||||
}
|
||||
|
||||
export function mapEmployeeToEmployeeApiRequestData(data: Employee): PegaEmployeeApiRequestData {
|
||||
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
|
||||
return data;
|
||||
}
|
||||
|
||||
export function mapEmployeeToPegaEmployeeApiRequestData(data: Employee): PegaEmployeeApiRequestData {
|
||||
return {
|
||||
pyFirstName: data.firstName,
|
||||
pyLastName: data.lastName,
|
||||
pyTelephone: data.phone,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -79,59 +74,41 @@ export function mapPegaEmployeeReponseToEmployee(data: PegaEmployeeApiResponse):
|
||||
lastName: data.pyLastName,
|
||||
firstName: data.pyFirstName,
|
||||
fullName: `${data.pyFirstName} ${data.pyLastName}`,
|
||||
organization: {
|
||||
id: '',
|
||||
name: data.pyOrganization,
|
||||
kaNumber: null,
|
||||
address: {
|
||||
street: null,
|
||||
houseNumber: null,
|
||||
postalCode: null,
|
||||
city: null,
|
||||
kommun: null,
|
||||
organizations: [
|
||||
{
|
||||
id: '',
|
||||
name: data.pyOrganization,
|
||||
kaNumber: null,
|
||||
address: {
|
||||
street: null,
|
||||
houseNumber: null,
|
||||
postalCode: null,
|
||||
city: null,
|
||||
kommun: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
phone: data.pyTelephone,
|
||||
email: '',
|
||||
authorizations: mapPegaAuthorizationToAuthorization(data.pyAccessGroup as PegaAuthorization),
|
||||
],
|
||||
authorizations: null,
|
||||
// authorizations: mapPegaAuthorizationToAuthorization(data.pyAccessGroup as PegaAuthorization),
|
||||
services: [],
|
||||
languages: [],
|
||||
outOfOffice: null,
|
||||
ssn: '',
|
||||
participants: [],
|
||||
active: true,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
||||
const {
|
||||
id,
|
||||
firstName,
|
||||
lastName,
|
||||
phone,
|
||||
email,
|
||||
ssn,
|
||||
active,
|
||||
services,
|
||||
languages,
|
||||
organization,
|
||||
authorizations,
|
||||
participants,
|
||||
} = data;
|
||||
const { id, firstName, lastName, ssn, services, languages, organizations, authorizations, participants } = data;
|
||||
return {
|
||||
id,
|
||||
firstName,
|
||||
lastName,
|
||||
fullName: `${firstName} ${lastName}`,
|
||||
organization,
|
||||
phone,
|
||||
email,
|
||||
organizations,
|
||||
authorizations,
|
||||
services,
|
||||
languages,
|
||||
outOfOffice: null,
|
||||
ssn,
|
||||
participants,
|
||||
active,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user