Files
mina-sidor-fa-web/mock-api/mina-sidor-fa/scripts/participants.js
Erik Tiekstra 03a2c7a42f 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
2021-08-18 07:10:28 +02:00

36 lines
1.1 KiB
JavaScript

import faker from 'faker';
import tjanster from './tjanster.js';
faker.locale = 'sv';
const TJANSTER = tjanster.generate();
const STATUSES = ['active', 'follow-up'];
const STEPS = ['Gemensam planering', 'Periodisk rapport', 'Resultatrapport', 'Slutrapport'];
function generateParticipants(amount = 10) {
const participants = [];
for (let i = 1; i <= amount; ++i) {
const participant = {
id: faker.datatype.uuid(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
status: STATUSES[Math.floor(Math.random() * STATUSES.length)],
service: TJANSTER[Math.floor(Math.random() * TJANSTER.length)].name,
nextStep: STEPS[Math.floor(Math.random() * STEPS.length)],
errandNumber: faker.datatype.number({ min: 100000, max: 999999 }),
startDate: faker.date.recent(),
endDate: faker.date.future(),
handleBefore: faker.date.soon(),
};
participants.push({ ...participant, fullName: `${participant.firstName} ${participant.lastName}` });
}
console.info('Participants generated...');
return participants;
}
export default {
generate: generateParticipants,
};