Added better staff mock data and updated several pages

This commit is contained in:
Erik Tiekstra
2021-04-09 08:48:22 +02:00
committed by Erik Tiekstra
parent cee9168c3c
commit 1ee6ca9251
27 changed files with 385 additions and 56 deletions

View File

@@ -7,3 +7,7 @@ Run `npm install` to install all dependencies.
## Get the mock-api up and running
Run `npm start` and navigate to `localhost:8000` to see a simple overview of the API. Navigate to [localhost:8000](localhost:8000) to see a quick explaination on which recources and routes are available inside the API.
### Mock delayed response
Run `npm run start:delay` to use the API with a delayed response.

View File

@@ -4,7 +4,8 @@
"description": "A mock api implementing all needed endpoints for dafa-web",
"scripts": {
"generate-api": "node ./scripts/generate-api.js",
"start": "npm run generate-api && json-server --watch api.json --port 8000 --routes routes.json"
"start": "npm run generate-api && json-server --watch api.json --port 8000 --routes routes.json",
"start:delay": "npm start -- --delay 500"
},
"author": "Erik Tiekstra (erik.tiekstra@arbetsformedlingen.se)",
"license": "MIT",

View File

@@ -10,9 +10,9 @@ const STEPS = ['Gemensam planering', 'Periodisk rapport', 'Resultatrapport', 'Sl
function generateParticipants(amount = 10) {
const participants = [];
for (let id = 1; id <= amount; ++id) {
for (let i = 1; i <= amount; ++i) {
participants.push({
id,
id: faker.random.uuid(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
status: STATUSES[Math.floor(Math.random() * STATUSES.length)],

View File

@@ -11,9 +11,10 @@ const STATUSES = [true, false];
function generateStaff(amount = 10) {
const staff = [];
for (let id = 1; id <= amount; ++id) {
for (let i = 1; i <= amount; ++i) {
staff.push({
id,
id: faker.random.uuid(),
staffId: faker.random.number(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
kommun: KOMMUN[Math.floor(Math.random() * KOMMUN.length)].kommun,