Squashed commit of the following:
commit 5c0f8d9b86b638801184f38016d16ffce2fddc56
Merge: 76eba37 d91b3e6
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Fri Jun 4 09:26:41 2021 +0200
Merged develop and resolved conflicts
commit 76eba37ca12407ba86ae08c8ef7fc06b873286cd
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu Jun 3 07:46:40 2021 +0200
Added functionality to create account inside mock-api
commit f0af4736b6a196db9a1306ca8b355c62610905ee
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu Jun 3 06:32:21 2021 +0200
Removed PEGA references from repository
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { Authorization } from './authorization.model';
|
|
import { Organization } from './organization.model';
|
|
import { Participant } from './participant.model';
|
|
import { Service } from './service.model';
|
|
import { User, UserApiResponse } from './user.model';
|
|
|
|
export interface Employee extends User {
|
|
languages: string[];
|
|
participants: Participant[];
|
|
services: Service[];
|
|
}
|
|
|
|
export interface EmployeeApiResponse extends UserApiResponse {
|
|
languages: string[];
|
|
participants: Participant[];
|
|
services: Service[];
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
export interface EmployeeApiRequestData {
|
|
firstName: string;
|
|
lastName: string;
|
|
ssn: string;
|
|
organizations: Organization[];
|
|
services: Service[];
|
|
authorizations: Authorization[];
|
|
}
|
|
|
|
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
|
|
const { firstName, lastName, ssn, services, organizations, authorizations } = data;
|
|
return {
|
|
firstName,
|
|
lastName,
|
|
ssn,
|
|
services,
|
|
organizations,
|
|
authorizations,
|
|
};
|
|
}
|
|
|
|
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
|
const { id, firstName, lastName, ssn, services, languages, organizations, authorizations, participants } = data;
|
|
return {
|
|
id,
|
|
firstName,
|
|
lastName,
|
|
fullName: `${firstName} ${lastName}`,
|
|
organizations,
|
|
authorizations,
|
|
services,
|
|
languages,
|
|
ssn,
|
|
participants,
|
|
};
|
|
}
|