GithubHelp home page GithubHelp logo

projeto18-poc-simplified-stock-rb's Introduction

projeto18-poc-simplified-stock-rb

A simplified stock control application.

About

This project is a simple application that satisfies the needs of Resinas Botânicas virtual store (@resinasbotanicas on instagram). Also, it's a proof of concept (POC) to get started with typescript.

How to run

  • Clone this repository
  • Run npm i or npm install to installl dependencies
  • Create a PostgreSQL database, you can choose the name you prefer
  • Configure the PostgreSQL database using the dump.sql file
  • Create a .env file with a PORT and a DATABASE_URL as in .env.example file
  • Run npm run dev to start the local server

API documentation

Table "categories" infos:

id name
1 brinco
2 anel
3 colar
4 pulseira
5 quadro

API endpoints

POST product

- Request

POST /product

{
	"categoryId": 1,
	"name": "cobra coral",
	"quantity": 3
}

- Response

Status: 201 Created

POST sold product

- Request

POST /product-sold

{
	"name": "cobra coral"
}

- Response

Status: 201 Created

GET products

- Request

  • All products: GET /products

  • Products by category: GET /products?category=brinco

- Response

  • All products

Status: 200 OK

[
	{
		"id": 1,
		"name": "borboleta",
		"quantity": 1,
		"category": "colar"
	},
	{
		"id": 2,
		"name": "estrela vermelha",
		"quantity": 2,
		"category": "brinco"
	}
]
  • Products by category "brinco":

Status: 200 OK

[
	{
		"id": 2,
		"name": "estrela vermelha",
		"quantity": 2,
		"category": "brinco"
	}
]

GET one product

- Request

GET /product/:id

- Response

Status: 200 OK

{
	"id": 1,
	"name": "borboleta",
	"quantity": 1,
	"category": "colar"
}

GET total products available

- Request

  • All products: GET /total-products-available

  • Products by category: GET /total-products-available?category=colar

- Response

  • All products

Status: 200 OK

{
	"total": 42
}
  • Products by category "colar":

Status: 200 OK

{
	"total": 12
}

GET total products sold

- Request

  • All products: GET /total-products-sold

  • Products by category: GET /total-products-sold?category=anel

- Response

  • All products

Status: 200 OK

{
	"total": 39
}
  • Products by category "anel":

Status: 200 OK

{
	"total": 11
}

UPDATE product quantity

- Request

PATCH /update-product

{
	"name": "estrela vermelha",
	"quantity": 1
}

- Response

Status: 200 OK

DELETE product

- Request

DELETE /delete-product/:id

- Response

Status: 204 No Content

projeto18-poc-simplified-stock-rb's People

Contributors

eumerme avatar

Watchers

 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.