This is a backend exercise using typescript, node, and express.
Key Libraries:
Recommended approach:
- For each exercise, create a pull request (PR) and merge your PR into main for your repository
Both exercises involve implementing code and then verifying that they perform as expected. You are also welcome to write tests to confirm the behavior as well
- Install node - recommend using nvm
- Run
npm installto install dependencies - Run
npm run prisma:setupto initialize the DB - Run the server with
npm run dev
All the exercises have existing test cases written to verify that the code is working as expected
- Do not modify any of the existing route definitions
- You'll need to implement the controller methods for exercises 4 and 5
- The exercise is configured to use Prisma for database operations.
Acceptance criteria
- As a user, I would like to confirm the API is running
Note: The status endpoint is /v1/status
Acceptance Criteria
- As a user I would like to retrieve a user by ID with fields:
- id
- firstName
- lastName
- dateOfBirth
- I should not be able to see the employee's secret
- If the ID does not exist in the DB, I expect to receive a 404
Acceptance Criteria
- As a user, I should be able to patch and employees first and last name
- As a user, I should receive a 400 if I try to set the first or last name to an empty string or null
- As a user, I should receive a 404 if the ID of the employee to patch does not exist
Acceptance Criteria
- As a user, I should be able to POST a new leave request with the following fields
- leave_start_date
- leave_end_date
- the ID of an employee
- I should receive a 400 if the POST body is invalid
- Missing fields
- Employee ID does not exist
- Invalid dates (start date after end date)
- The endpoint should be /v1/leave_requests
Acceptance Criteria
- As a user, I would like to be able to search for leave request
- I should be able to search by
- leave start date
- leave end date
- employee ID
- The endpoint should be /v1/leave_requests/search