Fixed issue with utforandeverksamheter in employees

This commit is contained in:
Erik Tiekstra
2021-09-06 15:23:48 +02:00
parent db03d97d54
commit b3283aaab3
6 changed files with 53 additions and 57 deletions

View File

@@ -22,7 +22,6 @@ export interface Employee {
tjanstCodes: string[];
tjanster?: Tjanst[];
allaUtforandeVerksamheter: boolean;
utforandeVerksamhet: string[];
utforandeVerksamhetIds: number[];
utforandeAdressIds: number[];
}
@@ -37,21 +36,12 @@ export interface EmployeeRequestData {
roles: string[];
tjansteKoder: string[];
allaUtforandeVerksamheter: boolean;
utforandeVerksamhet: string[];
utforandeVerksamhetIds: number[];
adressIds: number[];
}
export function mapEmployeeToRequestData(data: Employee): EmployeeRequestData {
const {
email,
roles,
tjanstCodes,
allaUtforandeVerksamheter,
utforandeVerksamhet,
utforandeVerksamhetIds,
utforandeAdressIds,
} = data;
const { email, roles, tjanstCodes, allaUtforandeVerksamheter, utforandeVerksamhetIds, utforandeAdressIds } = data;
return {
email,
@@ -60,7 +50,6 @@ export function mapEmployeeToRequestData(data: Employee): EmployeeRequestData {
utforandeVerksamhetIds,
adressIds: utforandeAdressIds,
allaUtforandeVerksamheter: allaUtforandeVerksamheter,
utforandeVerksamhet: utforandeVerksamhet,
};
}
@@ -85,7 +74,6 @@ export function mapResponseToEmployee(data: EmployeeResponse): Employee {
roles,
tjansteKoder,
allaUtforandeVerksamheter,
utforandeVerksamhet,
utforandeVerksamhetIds,
adressIds,
} = data;
@@ -99,7 +87,6 @@ export function mapResponseToEmployee(data: EmployeeResponse): Employee {
roles: roles || [],
tjanstCodes: tjansteKoder || [],
allaUtforandeVerksamheter,
utforandeVerksamhet: utforandeVerksamhet || [],
utforandeVerksamhetIds: utforandeVerksamhetIds || [],
utforandeAdressIds: adressIds || [],
};

View File

@@ -16,7 +16,7 @@ export function EmailValidator(label = 'Fältet'): ValidatorFn {
export function CommaSeparatedEmailValidator(): ValidatorFn {
return (control: AbstractControl): ValidationError => {
if (control && control.value) {
const values: string[] = (control.value as string).replaceAll(' ', '').split(',');
const values: string[] = (control.value as string).trim().split(',');
const invalidEmailaddresses = [];
values.forEach(value => {