Giter Site home page Giter Site logo

willfeliz1 / desafio-database-relations Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.76 MB

Challenge: allow the creation of customers, products and orders, where the customer can generate new purchase orders for certain products

JavaScript 16.13% TypeScript 83.87%

desafio-database-relations's Introduction

Desafio GoStack #09

๐Ÿ“• About

The main objective of this challenge is to allow the creation of customers, products and orders, where the customer can generate new purchase orders for certain products.

โšก Techs

  • Node.js - evented I/O for the backend
  • Express - fast node.js network app framework
  • Typescript - typed superset of JavaScript that compiles to plain JavaScript.
  • TypeORM - an ORM that can run in Nodej, browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used with TypeScript and JavaScript
  • Yarn - package manager that doubles down as project manager.
  • Tsyringe - A lightweight dependency injection container for TypeScript/JavaScript for constructor injection.
  • DotEnv - A module that loads environment variables from a .env file.

๐Ÿ’ป Installation

Docker

With docker hub installed, follow the commands:

$ docker run --name postgres -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgrees

$ docker start postgres

Start server

Install dependencies and start the server.

$ yarn
$ yarn typeorm migrations:run
$ yarn dev:server

Routes

  • POST /customers: This route must receive name and email inside body of request.
  • POST /products: This route must receive name, price e quantity inside body of request.
  • POST /orders: This route must receive in inside body of request the customer_id e an array of products, containing the id and quantity that you want to add to a new order.

If you want to see the unit testing ๐Ÿ˜Š

Before running the tests, create a database with the name "gostack_desafio09_tests" so that all tests can run correctly

$ yarn test

what he expects

๐Ÿ“Œ should be able to create a new customer
๐Ÿ“Œ should not be able to create a customer with one e-mail thats already registered
๐Ÿ“Œ should be able to create a new product
๐Ÿ“Œ should not be able to create a duplicated product
๐Ÿ“Œ should be able to create a new order
๐Ÿ“Œ should not be able to create an order with a invalid customer
๐Ÿ“Œ should not be able to create an order with invalid products
๐Ÿ“Œ should not be able to create an order with products with insufficient quantities
๐Ÿ“Œ should be able to subtract an product total quantity when it is ordered
๐Ÿ“Œ should be able to list one specific order

desafio-database-relations's People

Contributors

willfeliz1 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.