Skip to content

gajaguar/backend-technical-challenge-1

Repository files navigation

Backend Technical Challenge #1 version license

by: G.A.JAGUAR

A bookstore inventory management api.

typescript node.js express.js postgresql eslint prettier

Build Setup

Docker

Fast setup (only linux os)

# build docker container and install dependencies.
sh install.sh

Manual

# create a docker image
docker-compose build
# install dependencies
docker-compose run --rm server yarn
# serve with hot reload, by default at 127.0.0.1:3000
docker-compose up
# build for production and launch server
docker-compose run --rm server yarn build
docker-compose run --rm server yarn start

Local

# install dependencies
# pnpm (recommended to save disk space)
pnpm i
# or with yarn
yarn
# or native
npm install
# serve with hot reload, by default at 127.0.0.1:3000
pnpm dev
# build for production and launch server
pnpm build
pnpm start

Database

Tables

  • user
    • id
    • name
    • email
    • password
  • author
    • id
    • name
  • publisher
    • id
    • name
  • genre
    • id
    • name
  • book
    • id
    • name
    • authorId
    • publisherId
    • genreId
    • year
    • isbn
    • quantity

API

Enpoints

  • /api/users

    • POST
      • /: create a new user.
    • GET
      • /: read all users.
      • /:id: read specific user.
    • PATCH
      • /:id: update specific user.
    • DELETE
      • /:id: delete specific user.
  • /api/authors

    • POST
      • /: create a new author.
    • GET
      • /: read all authors.
      • /:id: read specific author.
    • PATCH
      • /:id: update specific author.
    • DELETE
      • /:id: delete specific author.
  • /api/publishers

    • POST
      • /: create a new publisher.
    • GET
      • /: read all publishers.
      • /:id: read specific publisher.
    • PATCH
      • /:id: update specific publisher.
    • DELETE
      • /:id: delete specific publisher.
  • /api/genres

    • POST
      • /: create a new genre.
    • GET
      • /: read all genres.
      • /:id: read specific genre.
    • PATCH
      • /:id: update specific genre.
    • DELETE
      • /:id: delete specific genre.
  • /api/books

    • POST
      • /: create a new book.
    • GET
      • /: read all books.
      • /:id: read specific book.
    • PATCH
      • /:id: update specific book.
    • DELETE
      • /:id: delete specific book.
  • /api/populate

    • GET
      • /: inter mocked data into the database.