{ "openapi": "3.0.3", "info": { "title": "API Pizzaria Documentation", "description": "API Pizzaria Backend", "version": "1.0.0", "contact": { "email": "lbrebelatto@gmail.com" } }, "paths": { "/users": { "post": { "tags": ["User"], "summary": "Create a user", "description": "Create a new user", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } }, "example": { "name": "name test", "email": "test@gmail.com", "password": "123456" } } } } }, "responses": { "200": { "description": "CREATED", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "email": { "type": "string" }, "name": { "type": "string" } }, "example": { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "email": "test@gmail.com", "name": "test name" } } } } }, "400": { "description": "user already exists!" } } } }, "/session": { "post": { "tags": ["User"], "summary": "Auth user", "description": "Auth user", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "example": { "email": "test@gmail.com", "password": "123456" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "email": { "type": "string" }, "name": { "type": "string" }, "token": { "type": "string" } }, "example": { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "email": "test@gmail.com", "name": "test name", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiR2FicmllbCIsImVtYWlsIjoibHVpenJlYmVsYXR0b0BnbWFpbC5jb20iLCJpYXQiOjE2NjI3NDY1NTYsImV4cCI6MTY2NTMzODU1Niwic3ViIjoiNDY3Y2M3YWEtYjA5Mi00MjdlLWFkNGEtNzhjYjE5ZTI3MTkxIn0.R_njamJozTRb3SBmBe8ag2mj9wqKgAgQ5I7-OhHmS4U" } } } } }, "400": { "description": "email/password incorrect" } } } }, "/user-info": { "get": { "tags": ["User"], "summary": "Detais user", "description": "informations of user", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string" } }, "example": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiR2FicmllbCIsImVtYWlsIjoibHVpenJlYmVsYXR0b0BnbWFpbC5jb20iLCJpYXQiOjE2NjI3NzYwMTUsImV4cCI6MTY2NTM2ODAxNSwic3ViIjoiNDY3Y2M3YWEtYjA5Mi00MjdlLWFkNGEtNzhjYjE5ZTI3MTkxIn0.AgR-rfQXUE6kxg_35-b4YqbGvL5pWDpwsRo1_vzUU94" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "email": { "type": "string" }, "name": { "type": "string" }, "password": { "type": "string" }, "created_at": { "type": "string"}, "updated_at": { "type": "string"} }, "example": { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "email": "test@gmail.com", "name": "test name", "password": "$2a$08$zc3CYuyRY1D1rxeHJra28uR1iO6jjULmyplsykIn1hjbLWcxrvRBi", "created_at": "2022-08-17T11:43:41.477Z", "updated_at": "2022-08-17T11:43:41.477Z" } } } } }, "400": { "description": "email/password incorrect" } } } }, "/list-category": { "get": { "tags": ["Category"], "summary": "List Categories", "description": "List of categories listed", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string" } }, "example": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiR2FicmllbCIsImVtYWlsIjoibHVpenJlYmVsYXR0b0BnbWFpbC5jb20iLCJpYXQiOjE2NjI3NzYwMTUsImV4cCI6MTY2NTM2ODAxNSwic3ViIjoiNDY3Y2M3YWEtYjA5Mi00MjdlLWFkNGEtNzhjYjE5ZTI3MTkxIn0.AgR-rfQXUE6kxg_35-b4YqbGvL5pWDpwsRo1_vzUU94" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "example": [ { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "name": "name category 1" }, { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "name": "name category 2" } ] } } } }, "400": { "description": "email/password incorrect" } } } }, "/category": { "post": { "tags": ["Category"], "summary": "Create Category", "description": "Create a new category", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } }, "example": { "name": "name category" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "example": { "id": "566dfd47-e5db-4cc7-b27a-4883e89c3f65", "name": "name category" } } } } }, "400": { "description": "name invalid" } } } }, "/order": { "post": { "tags": ["Order"], "summary": "Create Order", "description": "Create a new order, name attribute is optional", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "table": { "type": "integer($int32)" }, "name": {"type": "string", "required": false} }, "example": { "table": 5, "name": "name of table" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "table": { "type": "integer($int32)" }, "status": { "type": "boolean" }, "draft": { "type": "boolean" }, "name": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "example": { "id": "8a2784fe-9834-4c1a-ad49-a9984a3ab524", "table": 5, "status": false, "draft": true, "name": "name of table", "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z" } } } } } } } }, "/order/add": { "post": { "tags": ["Order"], "summary": "Add item", "description": "add the quantity of an item to an order", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "product_id": { "type": "string" }, "order_id": {"type": "string"}, "amount": { "type": "integer($int32)" } }, "example": { "product_id": "97cd889c-c982-415f-bdae-98fab56e3208", "order_id": "0a07a688-0bea-4abe-ae03-d0176e8a44c9", "amount": 5 } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "amount": { "type": "integer($int32)" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "order_id": { "type": "string" }, "product_id": { "type": "string" } }, "example": { "id": "8a2784fe-9834-4c1a-ad49-a9984a3ab524", "amount": 5, "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z", "order_id": "0a07a688-0bea-4abe-ae03-d0176e8a44c9", "product_id": "97cd889c-c982-415f-bdae-98fab56e3208" } } } } } } } }, "/order/send": { "put": { "tags": ["Order"], "summary": "Update order draft", "description": "When creating an order it will be created as draft as true so you can edit it before sending it to staging. This route changes the draft to false and indicates that the order has been completed and sent to staging.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "order_id": {"type": "string"} }, "example": { "order_id": "0a07a688-0bea-4abe-ae03-d0176e8a44c9" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "table": { "type": "integer($int32)" }, "status": { "type": "boolean" }, "draft": { "type": "boolean" }, "name": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "example": { "id": "89419a8a-3201-4e4d-bab6-6d1240f777de", "table": 5, "status": false, "draft": false, "name": null, "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z" } } } } } } } }, "/order/finish": { "put": { "tags": ["Order"], "summary": "Finish order", "description": "The status attribute tells you whether the order preparation has been completed or not. This route updates to true if the preparation has been completed.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "order_id": {"type": "string"} }, "example": { "order_id": "0a07a688-0bea-4abe-ae03-d0176e8a44c9" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "table": { "type": "integer($int32)" }, "status": { "type": "boolean" }, "draft": { "type": "boolean" }, "name": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "example": { "id": "89419a8a-3201-4e4d-bab6-6d1240f777de", "table": 5, "status": true, "draft": false, "name": null, "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z" } } } } } } } }, "/orders": { "put": { "tags": ["Order"], "summary": "Finish order", "description": "The status attribute tells you whether the order preparation has been completed or not. This route updates to true if the preparation has been completed.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "table": { "type": "integer($int32)" }, "status": { "type": "boolean" }, "draft": { "type": "boolean" }, "name": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "example": { "id": "89419a8a-3201-4e4d-bab6-6d1240f777de", "table": 5, "status": true, "draft": false, "name": null, "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "table": { "type": "integer($int32)" }, "status": { "type": "boolean" }, "draft": { "type": "boolean" }, "name": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "example": { "id": "89419a8a-3201-4e4d-bab6-6d1240f777de", "table": 5, "status": true, "draft": false, "name": null, "created_at": "2022-09-10T02:55:49.691Z", "updated_at": "2022-09-10T02:55:49.691Z" } } } } } } } }, "/order/{order_id}":{ "delete":{ "tags":["Order"], "summary":"Get order by order_id", "description":"Get order by order_id", "operationId":"order_id", "produces":[ "application/json" ], "parameters":[ { "name":"order_id", "in":"query", "description":"The order that needs to be deleted", "required":true, "type":"string" } ], "responses":{ "200":{ "description":"Ok" } } } }, "/order/remove/{item_id}":{ "delete":{ "tags":["Order"], "summary":"Get item by item_id", "description":"Get item by item_id", "operationId":"item_id", "produces":[ "application/json" ], "parameters":[ { "name":"item_id", "in":"query", "description":"The item that needs to be deleted", "required":true, "type":"string" } ], "responses":{ "200":{ "description":"Ok" } } } } } }