Skip to content

focusconsulting/focus-exercise-backend-typescript-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focus Backend Engineer Exercises - Typescript/Node/Express

Overview

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

Setup Instructions

  1. Install node - recommend using nvm
  2. Run npm install to install dependencies
  3. Run npm run prisma:setup to initialize the DB
  4. Run the server with npm run dev

Exercises

All the exercises have existing test cases written to verify that the code is working as expected

Implementation Notes

  • 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.

1. Fix the status endpoint

Acceptance criteria

  • As a user, I would like to confirm the API is running

Note: The status endpoint is /v1/status

2. Implement a GET employee endpoint

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

3. Implement a PATCH employee endpoint

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

4. Implement a POST endpoint for creating a new leave request for an employee

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

5. Implement a POST endpoint to search for 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

About

Focus - Backend Engineer Exercise using Typescript & Express

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors