{ "openapi": "3.0.0", "info": { "title": "API de notas autoadesivas", "description": "API tem como objetivo gerenciar notas autoadesivas", "contact": { "name": "Vitor Belarmino", "email": "vitor.belarmino@hotmail.com" } }, "version": "1.0.0", "servers": [ { "url": "http://localhost:3333", "description": "Servidor local" } ], "paths": { "/user/create": { "post": { "tags": ["User"], "summary": "Cria um novo usuário", "description": "Cria um novo usuário", "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "500": { "description": "Error interno do servidor" } } } }, "/user/{id}": { "get": { "tags": ["User"], "summary": "Retorna um usuário a partir do ID", "description": "Usado na aplicação para validar se o usuário existe, assim retornando o id do usuário", "parameters": [ { "name": "id", "in": "path", "description": "ID do usuário", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string", "example": "Usuário não encontrado" } } } } } } } }, "500": { "description": "Error interno do servidor" } } } }, "/user/{id}/notes": { "get": { "tags": ["Note"], "summary": "Lista todas as notas de um usuário", "description": "Lista todas as notas de um usuário", "parameters": [ { "name": "id", "in": "path", "description": "ID do usuário", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "notes": { "type": "array", "items": { "$ref": "#/components/schemas/Note" } } } } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string", "example": "Usuário não encontrado" } } } } } } } }, "500": { "description": "Error interno do servidor" } } } }, "/note/create": { "post": { "tags": ["Note"], "summary": "Cria uma nova nota", "description": "Cria uma nova nota", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/createNote" } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Note" } } } }, "400": { "description": "Error no corpo da requisição" }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string", "example": "Usuário não encontrado" } } } } } } } }, "500": { "description": "Error interno do servidor" } } } }, "/note/update/{id}": { "put": { "tags": ["Note"], "summary": "Atualiza uma nota", "description": "Atualiza uma nota", "parameters": [ { "name": "id", "in": "path", "description": "ID da nota", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/updateNote" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Note" } } } }, "400": { "description": "Error no corpo da requisição" }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string", "example": "Nota não encontrada" } } } } } } } }, "500": { "description": "Error interno do servidor" } } } }, "/note/delete/{id}": { "delete": { "tags": ["Note"], "summary": "Deleta uma nota", "description": "Deleta uma nota", "parameters": [ { "name": "id", "in": "path", "description": "ID da nota", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "No Content" }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string", "example": "Nota não encontrada" } } } } } } } }, "500": { "description": "Error interno do servidor" } } } } }, "components": { "schemas": { "User": { "type": "object", "properties": { "userId": { "type": "string" } } }, "findById": { "type": "object", "properties": { "id": { "type": "string" } } }, "Note": { "type": "object", "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "content": { "type": "string" }, "color": { "type": "string" }, "favorite": { "type": "boolean" }, "created_at": { "type": "date-time" }, "updated_at": { "type": "date-time" }, "userId": { "type": "string" } } }, "createNote": { "type": "object", "properties": { "title": { "type": "string" }, "content": { "type": "string" }, "favorite": { "type": "boolean" }, "userId": { "type": "string" } } }, "updateNote": { "type": "object", "properties": { "title": { "type": "string" }, "content": { "type": "string" }, "favorite": { "type": "boolean" }, "color": { "type": "string" }, "userId": { "type": "string" } } } } } }