Fixed employees without roles filter

This commit is contained in:
Erik Tiekstra
2021-08-18 14:51:28 +02:00
parent d69f69a993
commit 456f305f0e
2 changed files with 7 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ function generateEmployees(amount = 10) {
const lastName = faker.name.lastName(); const lastName = faker.name.lastName();
const currentTjanster = chooseRandom(TJANSTER, faker.datatype.number({ min: 1, max: TJANSTER.length })); const currentTjanster = chooseRandom(TJANSTER, faker.datatype.number({ min: 1, max: TJANSTER.length }));
const currentOrganizations = chooseRandom(ORGANIZATIONS, faker.datatype.number({ min: 1, max: 5 })); const currentOrganizations = chooseRandom(ORGANIZATIONS, faker.datatype.number({ min: 1, max: 5 }));
const hasBehorigheter = Math.random() > 0.1;
const employee = { const employee = {
ciamUserId: faker.datatype.uuid(), ciamUserId: faker.datatype.uuid(),
@@ -30,10 +31,11 @@ function generateEmployees(amount = 10) {
min: 1000, min: 1000,
max: 9999, max: 9999,
})}`, })}`,
tjanst: currentTjanster.map(tjanst => tjanst.name), roles: hasBehorigheter ? ['Admin'] : [],
tjansteKoder: currentTjanster.map(tjanst => tjanst.code), tjanst: hasBehorigheter ? currentTjanster.map(tjanst => tjanst.name) : [],
utforandeVerksamhet: currentOrganizations.map(organization => organization.name), tjansteKoder: hasBehorigheter ? currentTjanster.map(tjanst => tjanst.code) : [],
utforandeVerksamhetIds: currentOrganizations.map(organization => organization.id), utforandeVerksamhet: hasBehorigheter ? currentOrganizations.map(organization => organization.name) : [],
utforandeVerksamhetIds: hasBehorigheter ? currentOrganizations.map(organization => organization.id) : [],
}; };
employees.push(employee); employees.push(employee);

View File

@@ -15,7 +15,7 @@ server.use(
'/users/:id': '/employees?ciamUserId=:id', '/users/:id': '/employees?ciamUserId=:id',
'/users*': '/employees$1', '/users*': '/employees$1',
'/employees*search=*': '/employees$1fullName_like=$2', '/employees*search=*': '/employees$1fullName_like=$2',
'/employees*onlyEmployeesWithoutAuthorization=*': '/employees$1authorizations.length_gte=1', '/employees*onlyEmployeesWithoutAuthorization=*': '/employees$1roles.length_lte=0',
'/employees/invite': '/invites', '/employees/invite': '/invites',
'/employees*': '/employees$1', '/employees*': '/employees$1',
'/participants': '/participants?_embed=employees', '/participants': '/participants?_embed=employees',