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:
41
mock-api/mina-sidor-fa/scripts/employees.js
Normal file
41
mock-api/mina-sidor-fa/scripts/employees.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import faker from 'faker';
|
||||
import authorizations from './authorizations.js';
|
||||
import organizations from './organizations.js';
|
||||
import tjanster from './tjanster.js';
|
||||
|
||||
faker.locale = 'sv';
|
||||
|
||||
const TJANSTER = tjanster.generate();
|
||||
const ORGANIZATIONS = organizations.generate();
|
||||
|
||||
function generateEmployees(amount = 10) {
|
||||
const employees = [];
|
||||
|
||||
for (let i = 1; i <= amount; ++i) {
|
||||
const person = {
|
||||
id: faker.datatype.uuid(),
|
||||
firstName: faker.name.firstName(),
|
||||
lastName: faker.name.lastName(),
|
||||
ssn: `${faker.date.between('1950', '2000').toISOString().split('T')[0].replace(/-/g, '')}-${faker.datatype.number(
|
||||
{
|
||||
min: 1000,
|
||||
max: 9999,
|
||||
}
|
||||
)}`,
|
||||
organizations: [ORGANIZATIONS[Math.floor(Math.random() * ORGANIZATIONS.length)]],
|
||||
services: [TJANSTER[Math.floor(Math.random() * TJANSTER.length)]],
|
||||
authorizations: i % 2 === 0 ? authorizations.generate() : [],
|
||||
createdAt: Date.now(),
|
||||
};
|
||||
|
||||
person.fullName = `${person.firstName} ${person.lastName}`;
|
||||
employees.push(person);
|
||||
}
|
||||
|
||||
console.info('Employees generated...');
|
||||
return employees;
|
||||
}
|
||||
|
||||
export default {
|
||||
generate: generateEmployees,
|
||||
};
|
||||
Reference in New Issue
Block a user