encomende-back
To run this aplication on development mode:
- Clone this repository.
- Install all modules with this command: npm instal.
- Start the api with this command: npm run dev.
Endpoints:
AUTH ENDPOINTS
1) POST /signup - Body { cnpj: string, inscricaoEstadual: string, name: string, email: string().email(), password: string(), confirmPassword: ref("password"), phone: string, contact: string, cep: string, street: string, number: string, complement: string, neighbourhood: string, city: string, state: string } - creates a new user.2) POST /signin - Body { email: string, password: string } - to login. Returns a token.
CATALOG ENDPOINTS
3) GET /catalogo - Headers { Authorization: Bearer token } - get all catalog products.4) POST /catalogo - Body { search: String }, Headers { Authorization: Bearer token } - search for a catalog product by caracters. Returns array of products.
5) POST /catalogo/lista - Body { codeList: Number[] }, Headers { Authorization: Bearer token } - get a list of products by code. Return array of products. If code doesn't match with any products, returns null for this product in the array.
ORDER ENDPOINTS
6) POST /compra - Body { WIP schema }, Headers { Authorization: Bearer token } - post a new order.7) GET /compra/historico - Headers { Authorization: Bearer token } - gets all orders made by the token's owner. Return array of orders.
8) PUT /compra/status - Body { id: number, action: string("aprovado" | "rejeitado") }, Headers { Authorization: Bearer token } - update the order status.
PAINEL ENDPOINTS
9) GET /painel/abertas - Headers { Authorization: Bearer token } - gets open orders.10) GET /painel/aprovadas - Headers { Authorization: Bearer token } - gets approved orders.