import faker from 'faker'; import services from './services.js'; faker.locale = 'sv'; const SERVICES = services.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: SERVICES[Math.floor(Math.random() * SERVICES.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, };