refactor(project): Renamed all instances of dafa to msfa or mina-sidor-fa. (TV-379)

Squashed commit of the following:

commit d3f52ff6876f6e246c7d3c188e56cc2370289341
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Aug 17 14:10:38 2021 +0200

    Renamed all dafa instances to msfa
This commit is contained in:
Erik Tiekstra
2021-08-18 07:10:28 +02:00
parent 6d29baa533
commit 03a2c7a42f
349 changed files with 720 additions and 734 deletions

View File

@@ -0,0 +1,20 @@
import { AddressType, getAddressType } from '@msfa-enums/address-type.enum';
import { AddressResponse } from './api/address.response.model';
export interface Address {
type: AddressType;
street: string;
postalCode: string;
city: string;
country: string;
}
export function mapResponseToAddress(data: AddressResponse): Address {
return {
type: getAddressType(data.adresstyp),
street: data.gatuadress,
postalCode: data.postnummer,
city: data.postort,
country: data.land,
};
}

View File

@@ -0,0 +1,7 @@
export interface AddressResponse {
adresstyp: 'FBF' | 'EgenAngiven';
gatuadress: string;
postnummer: string;
postort: string;
land: string;
}

View File

@@ -0,0 +1,8 @@
export interface AuthenticationResponse {
id: string;
access_token: string;
scope: string;
id_token: string;
token_type: string;
expires_in: number;
}

View File

@@ -0,0 +1,30 @@
export interface AvropResponse {
id: string;
deltagare: string;
genomforandeReferens: number;
orgId: string;
leverantorId: number;
organisationsnummer: string;
utforandeVerksamhetId: number;
utforandeverksamhet: string;
kommunKod: string;
kommun: string;
utforandeAdressId: number;
adress: string;
ordernummer: string;
bokningsId: number;
personnummer: string;
sokandeId: number;
tjanstekod: string;
tjansteNamn: string;
deltagandeGrad: number;
startdatumAvrop: string;
slutdatumAvrop: string;
aktnummerDiariet: string;
tolkbehov: string;
sprakstod: string;
sparkod: string;
sparNamn: string;
supervisorId: number;
recievedTimestamp: string;
}

View File

@@ -0,0 +1,11 @@
import { AddressResponse } from './address.response.model';
import { PhoneNumberResponse } from './phonenumber.response.model';
export interface ContactInformationResponse {
fornamn: string;
efternamn: string;
personnummer: string;
epost: string;
telekomadresser: PhoneNumberResponse[];
adresser: AddressResponse[];
}

View File

@@ -0,0 +1,28 @@
import { AvropResponse } from './avrop.response.model';
import { ContactInformationResponse } from './contact-information.response.model';
import { DisabilitiesResponse } from './disabilities.response.model';
import { DriversLicenseResponse } from './drivers-license.response.model';
import { EducationsResponse } from './educations.response.model';
import { HighestEducationResponse } from './highest-education.response.model';
import { TranslatorResponse } from './translator.response.model';
import { WorkExperiencesResponse } from './work-experiences.response.model';
import { WorkLanguagesResponse } from './work-languages.response.model';
export interface DeltagareCompactResponse {
sokandeId: string;
deltagare: string;
kommun: string;
}
export interface DeltagareResponse {
id: string;
contact: ContactInformationResponse;
driverlicense: DriversLicenseResponse;
highestEducation: HighestEducationResponse;
educations: EducationsResponse;
translator: TranslatorResponse;
workLanguages: WorkLanguagesResponse;
disabilities: DisabilitiesResponse;
workExperiences: WorkExperiencesResponse;
avropInformation: AvropResponse;
}

View File

@@ -0,0 +1,5 @@
import { DisabilityResponse } from './disability.response.model';
export interface DisabilitiesResponse {
funktionsnedsattningar: DisabilityResponse[];
}

View File

@@ -0,0 +1,7 @@
export interface DisabilityResponse {
kod: string;
funktionsnedsattning: string;
beskrivning: string;
utgatt: boolean;
}

View File

@@ -0,0 +1,4 @@
export interface DriversLicenseResponse {
korkort: { behorighet: string };
tillgang_till_bil: boolean;
}

View File

@@ -0,0 +1,5 @@
export interface EducationLevelResponse {
utbildningsniva: string;
beskrivning: string;
taxonomy_id: number;
}

View File

@@ -0,0 +1,7 @@
export interface EducationResponse {
utbildning: string;
beskrivning: string;
anordnare: string;
period_from: string;
period_tom: string;
}

View File

@@ -0,0 +1,5 @@
import { EducationResponse } from './education.response.model';
export interface EducationsResponse {
utbildningar: EducationResponse[];
}

View File

@@ -0,0 +1,4 @@
export interface EmployeeInviteMockApiResponse {
id: number,
createdAt: number
}

View File

@@ -0,0 +1,4 @@
export interface HandledareResponse {
id: number;
name: string
}

View File

@@ -0,0 +1,6 @@
export interface HighestEducationResponse {
utbildningsniva: string;
beskrivning_utbildningsniva: string;
sun_kod: string;
beskrivning_sun_kod: string;
}

View File

@@ -0,0 +1,4 @@
export interface KommunResponse {
kommunCode: number;
kommun: string;
}

View File

@@ -0,0 +1,3 @@
export interface LanguageResponse {
beskrivning: string;
}

View File

@@ -0,0 +1,4 @@
export interface OrganizationResponse {
name: string;
organizationnumber: string;
}

View File

@@ -0,0 +1,5 @@
export interface PhoneNumberResponse {
landskod: number;
nummer_utan_inledande_nolla: number;
telekomtyp: 'Mobil' | 'Bostad';
}

View File

@@ -0,0 +1,4 @@
export interface SunKodResponse {
sun_kod: string;
beskrivning: string;
}

View File

@@ -0,0 +1,4 @@
export interface TjanstResponse {
code: string;
name: string;
}

View File

@@ -0,0 +1,5 @@
import { LanguageResponse } from './language.response.model';
export interface TranslatorResponse {
sprak: LanguageResponse;
}

View File

@@ -0,0 +1,6 @@
export interface UserInfoResponse {
id: string;
firstName: string;
lastName: string;
roles: string[];
}

View File

@@ -0,0 +1,4 @@
export interface UtforandeVerksamhetResponse {
id: number;
name: string;
}

View File

@@ -0,0 +1,7 @@
export interface WorkExperienceResponse {
yrke: string;
beskrivning: string;
arbetsgivare: string;
period_from: string;
period_tom: string;
}

View File

@@ -0,0 +1,5 @@
import { WorkExperienceResponse } from './work-experience.response.model';
export interface WorkExperiencesResponse {
arbetslivserfarenheter: WorkExperienceResponse[];
}

View File

@@ -0,0 +1,5 @@
import { LanguageResponse } from './language.response.model';
export interface WorkLanguagesResponse {
sprak: LanguageResponse[];
}

View File

@@ -0,0 +1,14 @@
import { AuthenticationResponse } from './api/authentication.response.model';
export interface Authentication {
idToken: string;
expiresIn: number;
}
export function mapAuthApiResponseToAuthenticationResult(data: AuthenticationResponse): Authentication {
const { id_token, expires_in } = data;
return {
idToken: id_token,
expiresIn: expires_in,
};
}

View File

@@ -0,0 +1,23 @@
import { Authorization as AuthorizationEnum } from '@msfa-enums/authorization.enum';
export interface Authorization {
id: string;
name: AuthorizationEnum;
}
export interface AuthorizationApiResponse {
data: AuthorizationApiResponseData[];
}
export interface AuthorizationApiResponseData {
id: string;
name: AuthorizationEnum;
}
export function mapAuthorizationApiResponseToAuthorization(data: AuthorizationApiResponseData): Authorization {
const { id, name } = data;
return {
id,
name,
};
}

View File

@@ -0,0 +1,57 @@
import { AvropResponse } from './api/avrop.response.model';
export interface AvropCompact {
id: string; // id
sokandeId: number; // sokandeId
fullName: string; // deltagare
tjanst: string; // tjansteNamn
startDate: Date; // startdatumAvrop
endDate: Date; // slutdatumAvrop
tolkbehov: string; // tolkbehov
sprakstod: string; // sprakstod
utforandeAdress: string; // adress
trackCode: string; // sparkod
trackName: string; // sparNamn
}
export interface Avrop extends AvropCompact {
genomforandeReferens: number; // genomforandeReferens
participationFrequency: number; // deltagandeGrad
utforandeVerksamhet: string; // utforandeverksamhet
}
export function mapAvropResponseToAvrop(data: AvropResponse): Avrop {
const {
id,
sokandeId,
deltagare,
tjansteNamn,
startdatumAvrop,
slutdatumAvrop,
tolkbehov,
sprakstod,
adress,
sparkod,
sparNamn,
genomforandeReferens,
deltagandeGrad,
utforandeverksamhet,
} = data;
return {
id,
sokandeId,
fullName: deltagare,
tjanst: tjansteNamn,
startDate: new Date(startdatumAvrop),
endDate: new Date(slutdatumAvrop),
tolkbehov: tolkbehov,
sprakstod: sprakstod,
utforandeAdress: adress,
trackCode: sparkod,
trackName: sparNamn,
genomforandeReferens,
participationFrequency: deltagandeGrad,
utforandeVerksamhet: utforandeverksamhet,
};
}

View File

@@ -0,0 +1,34 @@
import { Address, mapResponseToAddress } from './address.model';
import { ContactInformationResponse } from './api/contact-information.response.model';
import { mapResponseToPhoneNumber, PhoneNumber } from './phonenumber.model';
export interface ContactInformation {
firstName: string;
lastName: string;
fullName: string;
ssn: string;
email: string;
phoneNumbers: PhoneNumber[];
addresses: Address[];
}
export function mapResponseToContactInformation(contactInformation: ContactInformationResponse): ContactInformation {
return {
firstName: contactInformation.fornamn,
lastName: contactInformation.efternamn,
fullName: `${contactInformation.fornamn} ${contactInformation.efternamn}`,
ssn: `${contactInformation.personnummer.substring(
0,
contactInformation.personnummer.length - 4
)}-${contactInformation.personnummer.substring(contactInformation.personnummer.length - 4)}`,
email: contactInformation.epost,
phoneNumbers: contactInformation.telekomadresser
? contactInformation.telekomadresser.map(phoneNumber => {
return mapResponseToPhoneNumber(phoneNumber);
})
: [],
addresses: contactInformation.adresser
? contactInformation.adresser.map(address => mapResponseToAddress(address))
: null,
};
}

View File

@@ -0,0 +1,6 @@
export interface DateFormatOptions {
year?: 'short' | 'long' | 'numeric';
month?: 'short' | 'long' | 'numeric';
day?: 'short' | 'long' | 'numeric';
weekday?: 'short' | 'long' | 'numeric';
}

View File

@@ -0,0 +1,78 @@
import { Address } from './address.model';
import { AvropResponse } from './api/avrop.response.model';
import { DeltagareResponse } from './api/deltagare.response.model';
import { Avrop, mapAvropResponseToAvrop } from './avrop.model';
import { mapResponseToContactInformation } from './contact-information.model';
import { Disability, mapResponseToDisability } from './disability.model';
import { DriversLicense, mapResponseToDriversLicense } from './drivers-license.model';
import { Education, mapResponseToEducation } from './education.model';
import { HighestEducation, mapResponseToHighestEducation } from './highest-education.model';
import { PhoneNumber } from './phonenumber.model';
import { mapResponseToWorkExperience, WorkExperience } from './work-experience.model';
export interface DeltagareCompact {
id: string;
fullName: string;
utforandeVerksamhet: string;
utforandeAdress: string;
}
export interface Deltagare {
id: string;
fullName: string;
firstName: string;
lastName: string;
ssn: string;
email: string;
phoneNumbers: PhoneNumber[];
addresses: Address[];
driversLicense: DriversLicense;
educations: Education[];
highestEducation: HighestEducation;
translator: string;
disabilities: Disability[];
workLanguages: string[];
workExperiences: WorkExperience[];
avropInformation: Avrop;
}
export function mapResponseToDeltagareCompact(data: AvropResponse): DeltagareCompact {
const { sokandeId, deltagare, adress, utforandeverksamhet } = data;
return {
id: sokandeId.toString(),
fullName: deltagare,
utforandeVerksamhet: utforandeverksamhet,
utforandeAdress: adress,
};
}
export function mapResponseToDeltagare(data: DeltagareResponse): Deltagare {
const {
id,
contact,
driverlicense,
highestEducation,
educations,
translator,
workLanguages,
disabilities,
workExperiences,
avropInformation,
} = data;
return {
id,
...mapResponseToContactInformation(contact),
driversLicense: mapResponseToDriversLicense(driverlicense),
highestEducation: highestEducation && mapResponseToHighestEducation(highestEducation),
educations: educations && educations.utbildningar.map(education => mapResponseToEducation(education)),
translator: translator && translator.sprak.beskrivning,
workLanguages: workLanguages && workLanguages.sprak.map(language => language.beskrivning),
disabilities:
disabilities && disabilities.funktionsnedsattningar.map(disability => mapResponseToDisability(disability)),
workExperiences:
workExperiences &&
workExperiences.arbetslivserfarenheter.map(workExperience => mapResponseToWorkExperience(workExperience)),
avropInformation: avropInformation && mapAvropResponseToAvrop(avropInformation),
};
}

View File

@@ -0,0 +1,16 @@
import { DisabilityResponse } from './api/disability.response.model';
export interface Disability {
code: string;
title: string;
description: string;
}
export function mapResponseToDisability(data: DisabilityResponse): Disability {
const { kod, funktionsnedsattning, beskrivning } = data;
return {
code: kod,
title: funktionsnedsattning,
description: beskrivning,
};
}

View File

@@ -0,0 +1,29 @@
import { DRIVERS_LICENSES } from '@msfa-constants/drivers-licenses';
import { DriversLicenseResponse } from './api/drivers-license.response.model';
export interface DriversLicense {
licenses: string[];
accessToCar: boolean;
}
function mapLicensesAsStringToArray(licenses = ''): string[] {
const allLicenses = DRIVERS_LICENSES.sort((a, b) => b.length - a.length);
let search = licenses;
const found: string[] = [];
allLicenses.forEach(license => {
if (search.indexOf(license) >= 0) {
found.push(license);
search = search.replace(license, '');
}
});
return found;
}
export function mapResponseToDriversLicense(data: DriversLicenseResponse): DriversLicense {
return {
licenses: mapLicensesAsStringToArray(data.korkort.behorighet),
accessToCar: data.tillgang_till_bil,
};
}

View File

@@ -0,0 +1,22 @@
import { formatToDate } from '@msfa-utils/format-to-date.util';
import { EducationResponse } from './api/education.response.model';
export interface Education {
education: string;
description: string;
organizer: string;
dateFrom: Date;
dateTo: Date;
}
export function mapResponseToEducation(data: EducationResponse): Education {
const { utbildning, beskrivning, anordnare, period_from, period_tom } = data;
return {
education: utbildning,
description: beskrivning,
organizer: anordnare,
dateFrom: formatToDate(period_from),
dateTo: formatToDate(period_tom),
};
}

View File

@@ -0,0 +1,3 @@
export interface EmployeeInviteMockaData {
id: number
}

View File

@@ -0,0 +1,75 @@
import { Authorization } from '@msfa-enums/authorization.enum';
import { Organization } from './organization.model';
import { PaginationMeta } from './pagination-meta.model';
import { Service } from './service.model';
export interface Employee {
id: string;
firstName: string;
lastName: string;
fullName?: string;
ssn: string;
organizations: Organization[];
services: Service[];
authorizations: Authorization[];
createdAt?: number;
}
export interface EmployeesApiResponse {
data: Employee[];
meta: PaginationMeta;
}
export interface EmployeesData {
data: Employee[];
meta: PaginationMeta;
}
export interface EmployeeApiResponse {
data: Employee;
}
export interface EmployeeApiResponseData {
id: string;
firstName: string;
lastName: string;
ssn: string;
organizations: Organization[];
authorizations: Authorization[];
services: Service[];
}
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: EmployeeApiResponseData): Employee {
const { id, firstName, lastName, ssn, services, organizations, authorizations } = data;
return {
id,
firstName,
lastName,
fullName: `${firstName} ${lastName}`,
organizations,
authorizations,
services,
ssn,
};
}

View File

@@ -0,0 +1,10 @@
export interface Environment {
environment: 'api' | 'local' | 'prod';
clientId: string;
loginUrl: string;
production: boolean;
api: {
url: string;
headers: { [key: string]: string };
};
}

View File

@@ -0,0 +1,71 @@
import { ErrorSeverity } from '@msfa-enums/error-severity.enum';
import { ErrorType } from '@msfa-enums/error-type.enum';
export class CustomError implements Error {
id: string;
name: string;
message: string;
stack: string;
type: ErrorType;
severity: ErrorSeverity;
timestamp: Date;
error: Error;
removeAfter: number;
constructor(args: { error: Error; type?: ErrorType; message?: string; severity?: ErrorSeverity; stack?: string }) {
this.timestamp = new Date();
this.id = this.timestamp.getTime().toString();
this.type = this.name = args.type || ErrorType.UNKNOWN;
this.message = args.message || args.error.message;
this.severity = args.severity || ErrorSeverity.HIGH;
this.stack = args.stack || CustomError.getStack(args.error);
this.error = args.error;
this.removeAfter =
this.severity === ErrorSeverity.LOW ? 5000 : this.severity === ErrorSeverity.MEDIUM ? 10000 : 20000;
}
static getStack(error: Error | { error: Error }): string {
if (!error) {
return '';
}
if (typeof error === 'string') {
return error;
}
if ('stack' in error) {
return error.stack;
} else if ('error' in error) {
return this.getStack(error.error);
} else {
return error as never;
}
}
static getErrorType(error: Error | (Error & { type: ErrorType })): ErrorType {
if (typeof error === 'object' && 'type' in error) {
return error.type;
} else if (error.name === 'HttpErrorResponse') {
return ErrorType.API;
}
return ErrorType.UNKNOWN;
}
}
export function errorToCustomError(error: Error & { ngDebugContext: unknown }): CustomError {
const type = CustomError.getErrorType(error);
const message = error.message || error;
const severity = ErrorSeverity.HIGH;
// this is done to avoid circular references while running in debug mode
if ('ngDebugContext' in error) {
error.ngDebugContext = {};
}
return new CustomError({
error,
type,
severity,
message: message as string,
});
}

View File

@@ -0,0 +1,17 @@
import { HandledareResponse } from './api/handledare.response.model';
export interface Handledare {
id: number;
name: string;
}
export function mapHandledareResponseToHandledare(
data: HandledareResponse
): Handledare {
const { id, name } = data;
return {
id,
name
}
}

View File

@@ -0,0 +1,27 @@
import { HighestEducationResponse } from './api/highest-education.response.model';
export interface HighestEducation {
level: {
code: string;
description: string;
};
sunKod: {
code: string;
description: string;
};
}
export function mapResponseToHighestEducation(data: HighestEducationResponse): HighestEducation {
const { utbildningsniva, beskrivning_utbildningsniva, sun_kod, beskrivning_sun_kod } = data;
return {
level: {
code: utbildningsniva,
description: beskrivning_utbildningsniva,
},
sunKod: {
code: sun_kod,
description: beskrivning_sun_kod,
},
};
}

View File

@@ -0,0 +1,15 @@
import { KommunResponse } from './api/kommun.response.model';
export interface Kommun {
id: number;
name: string;
}
export function mapKommunResponseToKommun(data: KommunResponse): Kommun {
const { kommunCode, kommun } = data;
return {
id: kommunCode,
name: kommun
};
}

View File

@@ -0,0 +1,5 @@
export interface MultiselectFilterOption {
label?: string;
id?: string;
count?: number;
}

View File

@@ -0,0 +1,15 @@
import { OrganizationResponse } from './api/organization.response.model';
export interface Organization {
name: string;
organizationNumber: string;
}
export function mapResponseToOrganization(data: OrganizationResponse): Organization {
const { name, organizationnumber } = data;
return {
name,
organizationNumber: organizationnumber,
};
}

View File

@@ -0,0 +1,5 @@
export interface OutOfOfficeDate {
id: number;
start: Date;
end: Date;
}

View File

@@ -0,0 +1,6 @@
export interface PaginationMeta {
count: number;
limit: number;
page: number;
totalPages: number;
}

View File

@@ -0,0 +1,71 @@
import { ParticipantStatus } from '@msfa-enums/participant-status.enum';
import { Service } from '@msfa-enums/service.enum';
import { PaginationMeta } from './pagination-meta.model';
export interface Participant {
id: string;
firstName: string;
lastName: string;
fullName: string;
ssn: string;
status: ParticipantStatus;
nextStep: string;
service: Service;
errandNumber: number;
startDate: Date;
endDate: Date;
handleBefore: Date;
}
export interface ParticipantsApiResponse {
data: ParticipantApiResponseData[];
meta?: PaginationMeta;
}
export interface ParticipantApiResponse {
data: ParticipantApiResponseData;
}
export interface ParticipantApiResponseData {
id: string;
firstName: string;
lastName: string;
ssn: string;
status: ParticipantStatus;
nextStep: string;
service: Service;
errandNumber: number;
startDate: Date;
endDate: Date;
handleBefore: Date;
}
export function mapParticipantApiResponseToParticipant(data: ParticipantApiResponseData): Participant {
const {
id,
firstName,
lastName,
ssn,
status,
nextStep,
service,
errandNumber,
startDate,
endDate,
handleBefore,
} = data;
return {
id,
firstName,
lastName,
fullName: `${firstName} ${lastName}`,
ssn,
status,
nextStep,
service,
errandNumber,
startDate,
endDate,
handleBefore,
};
}

View File

@@ -0,0 +1,14 @@
import { getPhoneNumberType, PhoneNumberType } from '@msfa-enums/phonenumber-type.enum';
import { PhoneNumberResponse } from './api/phonenumber.response.model';
export interface PhoneNumber {
type: PhoneNumberType;
number: string;
}
export function mapResponseToPhoneNumber(data: PhoneNumberResponse): PhoneNumber {
return {
type: getPhoneNumberType(data.telekomtyp),
number: `+${data.landskod}${data.nummer_utan_inledande_nolla}`,
};
}

View File

@@ -0,0 +1,23 @@
import { Service as ServiceEnum } from '@msfa-enums/service.enum';
export interface Service {
id: string;
name: ServiceEnum;
}
export interface ServiceApiResponse {
data: ServiceApiResponseData[];
}
export interface ServiceApiResponseData {
id: string;
name: ServiceEnum;
}
export function mapServiceApiResponseToService(data: ServiceApiResponseData): Service {
const { id, name } = data;
return {
id,
name,
};
}

View File

@@ -0,0 +1,6 @@
import { SortOrder } from '@msfa-enums/sort-order.enum';
export interface Sort<Key> {
key: Key;
order: SortOrder;
}

View File

@@ -0,0 +1,15 @@
import { TjanstResponse } from './api/tjanst.response.model';
export interface Tjanst {
code: string;
name: string;
}
export function mapTjanstResponseToTjanst(data: TjanstResponse): Tjanst {
const { code, name } = data;
return {
code,
name,
};
}

View File

@@ -0,0 +1,21 @@
import { UserInfoResponse } from './api/user-info.response.model';
export interface UserInfo {
id: string;
firstName: string;
lastName: string;
fullName: string;
roles: string[];
}
export function mapResponseToUserInfo(data: UserInfoResponse): UserInfo {
const { id, firstName, lastName, roles } = data;
return {
id,
firstName,
lastName,
fullName: `${firstName} ${lastName}`,
roles,
};
}

View File

@@ -0,0 +1,21 @@
import { OrganizationResponse } from './api/organization.response.model';
import { UserInfoResponse } from './api/user-info.response.model';
import { mapResponseToOrganization, Organization } from './organization.model';
import { UserInfo } from './user-info.model';
export interface User extends UserInfo {
organizations: Organization[];
}
export function mapUserApiResponseToUser(userInfo: UserInfoResponse, organizations: OrganizationResponse[]): User {
const { id, firstName, lastName, roles } = userInfo;
return {
id,
firstName,
lastName,
fullName: `${firstName} ${lastName}`,
roles,
organizations: organizations ? organizations.map(organization => mapResponseToOrganization(organization)) : [],
};
}

View File

@@ -0,0 +1,17 @@
import { UtforandeVerksamhetResponse } from './api/utforande-verksamhet.response.model';
export interface UtforandeVerksamhet {
id: number;
name: string;
}
export function mapUtforandeVerksamhetResponseToUtforandeVerksamhet(
data: UtforandeVerksamhetResponse
): UtforandeVerksamhet {
const { id, name } = data;
return {
id,
name,
};
}

View File

@@ -0,0 +1,4 @@
export interface ValidationError {
type: string;
message: string;
}

View File

@@ -0,0 +1,22 @@
import { formatToDate } from '@msfa-utils/format-to-date.util';
import { WorkExperienceResponse } from './api/work-experience.response.model';
export interface WorkExperience {
profession: string;
description: string;
employer: string;
dateFrom: Date;
dateTo: Date;
}
export function mapResponseToWorkExperience(data: WorkExperienceResponse): WorkExperience {
const { yrke, beskrivning, arbetsgivare, period_from, period_tom } = data;
return {
profession: yrke,
description: beskrivning,
employer: arbetsgivare,
dateFrom: formatToDate(period_from),
dateTo: formatToDate(period_tom),
};
}