Workflow is triggered by SQS messages. During the execution, it retrieves an employee absence data from api.nmbrs.nl API and saves as JSON files with the required structure.
Main used dependencies:
During the implemented was used node v10.16.3. v10.12.0 version of node is required because fs.mkdir
with options.recursive
= true was used.
- Install dependencies and build using
npm install
. - Copy
example.env
as.env
and update it according to a queue details which will be used to trigger the workflow. - Run the workflow using
npm start
. - Send message to the queue.
- Check logs and an ./output directory.
- The workflow can be stopped by Ctrl + z(Windows).
- To re-build the workflow use
npm run build
.
- Run the Mocha by
npm test
.
- Copy
example.env
as.env
. - Install Docker Compose, run the Docker and update
.env/SQS_URL
withDocker default machine IP
:4576, e.g.SQS_URL=http://localhost:4576
- Run the Local Stack and create a queue by command
npm run startLocalStack
. - Uncomment below two lines in
src/index.ts
:
// const messageCommand = "{'source_app' => 'nmbrs', 'user' => '[email protected]', 'pass' => '2ed523df992646bf9bcfef66f75ef758', 'group' => 1234, 'controller' => 'importDaysoff',}";
// lib.sendMessage(sqs, queueUrl, messageCommand);
- Build the workflow by command
npm run build
. - Run workflow by command
npm start
. - Check logs and an ./output folder.
- The workflow can be stopped by Ctrl + z(Windows).
- To restore workflow to normal state revert changes from point 4 and re-build the code(point 5).
- .vscode directory was committed to the repository to let to debug the workflow execution and unit tests execution in VSCode.
- Unit test contain assertions strictly testing the correctnes of data generated by the workflow.
- Assertion for
IEmployeData.historical_days_off[item].date
compares parsed Date to solve timezones difference problem. - Unit tests related to error handling was skipped due to time limits.