feat(api): Added connection to the dotnet api (TV-189)
Squashed commit of the following:
commit 6f06bf69b87c77473c21fbe5fcc5669964793b17
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 15:01:16 2021 +0200
Fixed issue with including qp insde breadcrumbs
commit 579b6105acc7a60864f07b6082329872a2105bd3
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 14:46:54 2021 +0200
Added some more data to the mock-api and fixed navigation-bar
commit f9b820136017584655fadafaf716155aec85316e
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu May 20 10:11:55 2021 +0200
Updated mock-api
commit 5367d2a475b1c0b8807cf5a9c3f8987b3a586de4
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 19 16:00:07 2021 +0200
Added different config for dotnet api
commit 47de5b8ad7c0924c82f07568aa2a4386613e3bd6
Merge: 22d5e9a dc40953
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 19 07:54:55 2021 +0200
Merged develop
commit 22d5e9a126e3c1237531407ec3e6d47fbfea55e8
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Wed May 12 11:48:25 2021 +0200
Added new configuration to talk with local API
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import faker from 'faker';
|
||||
import agencies from './agencies.js';
|
||||
import kommuner from './kommuner.js';
|
||||
import languages from './languages.js';
|
||||
import organizations from './organizations.js';
|
||||
import services from './services.js';
|
||||
import chooseRandom from './utils/choose-random.util.js';
|
||||
|
||||
faker.locale = 'sv';
|
||||
|
||||
const SERVICES = services.generate();
|
||||
const KOMMUN = kommuner.generate();
|
||||
const AGENCIES = agencies.generate();
|
||||
const ORGANIZATIONS = organizations.generate();
|
||||
const STATUSES = [true, false];
|
||||
const LANGUAGES = languages.generate();
|
||||
const AUTHORISATIONS = ['Hantera användare', 'Hantera origisation', 'Hantera ekonomi'];
|
||||
const AUTHORIZATIONS = ['Hantera användare', 'Hantera origisation', 'Hantera ekonomi'];
|
||||
|
||||
function generateEmployees(amount = 10) {
|
||||
const employees = [];
|
||||
@@ -20,16 +19,8 @@ function generateEmployees(amount = 10) {
|
||||
for (let i = 1; i <= amount; ++i) {
|
||||
const person = {
|
||||
id: faker.datatype.uuid(),
|
||||
employeeId: faker.datatype.number(),
|
||||
firstName: faker.name.firstName(),
|
||||
lastName: faker.name.lastName(),
|
||||
kommun: KOMMUN[Math.floor(Math.random() * KOMMUN.length)].kommun,
|
||||
active: STATUSES[Math.floor(Math.random() * STATUSES.length)],
|
||||
service: SERVICES[Math.floor(Math.random() * SERVICES.length)].name,
|
||||
languages: [
|
||||
LANGUAGES.find(language => language.name === 'Svenska'),
|
||||
...chooseRandom(LANGUAGES, faker.datatype.number(3)),
|
||||
],
|
||||
ssn: `${faker.date.between('1950', '2000').toISOString().split('T')[0].replace(/-/g, '')}-${faker.datatype.number(
|
||||
{
|
||||
min: 1000,
|
||||
@@ -38,19 +29,25 @@ function generateEmployees(amount = 10) {
|
||||
)}`,
|
||||
phone: `07${faker.datatype.number(9)}-${faker.datatype.number({ min: 1000000, max: 9999999 })}`,
|
||||
email: faker.internet.email(),
|
||||
authorisations: chooseRandom(AUTHORISATIONS, faker.datatype.number(3)),
|
||||
outOfOffice: STATUSES[Math.floor(Math.random() * STATUSES.length)]
|
||||
? [
|
||||
{
|
||||
start: new Date('2021-07-12'),
|
||||
end: new Date('2021-07-24'),
|
||||
},
|
||||
]
|
||||
: [],
|
||||
agencies: chooseRandom(AGENCIES, faker.datatype.number(3)),
|
||||
organization: ORGANIZATIONS[Math.floor(Math.random() * ORGANIZATIONS.length)],
|
||||
services: [SERVICES[Math.floor(Math.random() * SERVICES.length)].name],
|
||||
authorizations: AUTHORIZATIONS,
|
||||
// active: STATUSES[Math.floor(Math.random() * STATUSES.length)],
|
||||
// languages: [
|
||||
// LANGUAGES.find(language => language.name === 'Svenska'),
|
||||
// ...chooseRandom(LANGUAGES, faker.datatype.number(3)),
|
||||
// ],
|
||||
// outOfOffice: STATUSES[Math.floor(Math.random() * STATUSES.length)]
|
||||
// ? [
|
||||
// {
|
||||
// start: new Date('2021-07-12'),
|
||||
// end: new Date('2021-07-24'),
|
||||
// },
|
||||
// ]
|
||||
// : [],
|
||||
};
|
||||
|
||||
employees.push({ ...person, fullName: `${person.firstName} ${person.lastName}` });
|
||||
employees.push(person);
|
||||
}
|
||||
|
||||
console.info('Employees generated...');
|
||||
|
||||
Reference in New Issue
Block a user