owner | description | status | criticality | type |
---|---|---|---|---|
Client Tools |
JavaScript BE/FS test task. |
development |
none |
candidate test task |
Table of Contents
The aim of this test task is to measure the technical capabilities of a candidate on building well structured RESTful APIs using best practices and well known patterns.
Say we have a verification flow where the user is asked to upload both sides of the document. For each step in the verification flow a different part of the document is asked to be uploaded.
- In the first step it is asked to upload an image containing the front side of the document, as a result
document-front
context is being set. - In the second step it is asked to upload an image containing the back side of the document, as a result
document-back
context is being set.
Now there is an imperfection in the flow, if the user decides to upload the image of the document back in the first step, there will be a misalignment of the uploaded image of the document side and the context. Also, so it could happen that the user accidentally uploads the image of their knee or a keyboard. Fortunately we have an automation to help us to identify the correct document side.
We have three service endpoints to use.
- Session details endpoint
GET https://api.veriff.internal/sessions/:sessionId
{ id: '90d61876-b99a-443e-994c-ba882c8558b6', // UUID v4 status: 'internal_manual_review' // Status }
- Session media endpoint
GET https://api.veriff.internal/sessions/:sessionId/media
[ { id: '7f2dcbd8-5b5f-4f1a-bfa4-016ddf4dd662', // UUID v4 mimeType: 'image/png', // Media mime type context: 'document-front', // Media context type }, ];
- Media context endpoint
GET https://api.veriff.internal/media-context/:sessionId
[ { id: 'a4338068-d99b-416b-9b2d-ee8eae906eea', // UUID v4 mediaId: 'a6c90b4f-ddfc-49eb-89ad-05b7f1274f96', // UUID v4 related to media context: 'back', // Detected media context type (front, back, none - in case the image is irrelevant) probability: 0.9739324, // Probability value }, ];
The acceptance criteria for the required feature would be to create a RESTful GET endpoint that returns the session and media with combined details relevant to the consumer of the API.
The structure of the RESTful GET endpoint would be defined by you, but it should meet the following criteria:
- Fix the media context in the response using
/sessions/:sessionId/media
and/media-context/:sessionId
endpoints to have only relevant and corrected media as a result - Group media by the context type
- Irrelevant media must be filtered out
- Media list must be sorted by probability descending
- Implement at least one test, which must pass on every run
- We kindly ask you to use
sessionId
90d61876-b99a-443e-994c-ba882c8558b6
as an input for the endpoints. - Change files, project structure as you see fit, but please make sure the initial logic itself in
externalService.ts
is intact. - If you feel that you lack some of the types or interfaces from a given files, you can introduce them as well.
- Please use git while working on the test task, this is important for us to understand how you approach to the solution. While creating zip package with your test task solution, make sure to include
.git
folder. - We would not set a deadline for when to complete the task, but we would want you to give us the time estimate of how long the test task will take. Kindly noting that we appreciate the quality over the speed of delivery.
Here is the list of the technologies we use in our services daily:
This project is set up with NodeJS LTS version 14 in mind https://nodejs.org/download/release/latest-v14.x with a default packaged NPM
- Set node version via (nvm)
nvm install # or nvm use
- Install the dependencies
npm install
- Run the service
npm start
- Run the tests
npm test
Distributed under the MIT License. See LICENSE
for more information.