{ "openapi": "3.0.1", "info": { "title": "API Bom click", "description": "API de consulta de Preços.", "version": "1.0.0" }, "paths": { "/CadastroUsuarios": { "post": { "summary": "Cadastra um novo usuário", "description": "Recebe os dados do usuário e os armazena no banco de dados.", "tags": ["Usuario"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "nome": { "type": "string" }, "cpf": { "type": "string" }, "dataNascimento": { "type": "string", "format": "date-time" }, "senha": { "type": "string" }, "cep": { "type": "string" }, "logradouro": { "type": "string" }, "bairro": { "type": "string" }, "numero": { "type": "integer" }, "email": { "type": "string", "format": "email" } }, "required": [ "nome", "cpf", "dataNascimento", "senha", "cep", "logradouro", "bairro", "numero", "email" ] } } } }, "responses": { "201": { "description": "Usuário cadastrado com sucesso.", "content": { "application/json": { "schema": { "type": "object", "properties": { "mensagem": { "type": "string" } } } } } }, "500": { "description": "Erro interno no servidor.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } } } } }, "/BuscaUsuarios": { "get": { "summary": "Busca todos os usuários", "description": "Retorna a lista de usuários cadastrados no sistema.", "operationId": "buscaUsuarios", "tags": ["Usuario"], "responses": { "200": { "description": "Lista de usuários retornada com sucesso", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "nome": { "type": "string", "example": "João Silva" }, "email": { "type": "string", "example": "joao@email.com" } } } } } } }, "500": { "description": "Erro interno ao buscar usuários", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao buscar usuário." } } } } } } } } }, "/BuscaUsuariosUnico/{id}": { "post": { "summary": "Busca um usuário pelo ID", "description": "Retorna os dados de um usuário específico com base no ID fornecido.", "operationId": "buscaUsuarioUnico", "tags": ["Usuario"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "ID do usuário a ser buscado" } ], "responses": { "200": { "description": "Usuário encontrado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "example": "123" }, "nome": { "type": "string", "example": "Maria Oliveira" }, "email": { "type": "string", "example": "maria@email.com" } } } } } }, "404": { "description": "Usuário não encontrado", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Usuário não encontrado." } } } } } }, "500": { "description": "Erro interno ao buscar usuário", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao buscar usuário único." } } } } } } } } }, "/AlteraDadosUsuario/{id}": { "put": { "summary": "Altera os dados de um usuário pelo ID", "description": "Atualiza os dados de um usuário específico com base no ID fornecido.", "operationId": "alteraDadosUsuario", "tags": ["Usuario"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "ID do usuário a ser atualizado" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "nome": { "type": "string", "example": "Carlos Souza" }, "cpf": { "type": "string", "example": "123.456.789-00" }, "dataNascimento": { "type": "string", "format": "date-time" }, "cep": { "type": "string", "example": "01010-010" }, "logradouro": { "type": "string", "example": "Rua das Flores" }, "bairro": { "type": "string", "example": "Centro" }, "numero": { "type": "integer", "example": 100 }, "email": { "type": "string", "example": "carlos@email.com" } } } } } }, "responses": { "200": { "description": "Usuário atualizado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "mensagem": { "type": "string", "example": "Alterado com Sucesso" } } } } } }, "404": { "description": "Usuário não encontrado", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Usuário não encontrado." } } } } } }, "500": { "description": "Erro interno ao alterar usuário", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao alterar usuário." } } } } } } } } }, "/DeletaUsuario/{id}": { "delete": { "summary": "Deleta um usuário pelo ID", "description": "Remove um usuário do sistema com base no ID fornecido.", "operationId": "deletarUsuarioUnico", "tags": ["Usuario"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "ID do usuário a ser deletado" } ], "responses": { "200": { "description": "Usuário deletado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "mensagem": { "type": "string", "example": "Usuário deletado com sucesso." } } } } } }, "404": { "description": "Usuário não encontrado", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Usuário não encontrado." } } } } } }, "500": { "description": "Erro interno ao deletar usuário", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao deletar usuário." } } } } } } } } }, "/CadastroMercado": { "post": { "tags": ["Mercado"], "summary": "Cadastrar um novo mercado", "requestBody": { "description": "Dados do mercado a ser cadastrado", "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "nome": { "type": "string", "example": "Mercado Central" }, "logo": { "type": "string", "example": "https://exemplo.com/logo.png" } }, "required": ["nome", "logo"] } } } }, "responses": { "201": { "description": "Cadastro realizado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "mensagem": { "type": "string", "example": "Cadastro efetuado com sucesso!" } } } } } }, "500": { "description": "Erro interno ao cadastrar mercado", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao cadastrar mercado." } } } } } } } } }, "/BuscaMercado": { "get": { "summary": "Busca mercado", "description": "Retorna a lista de mercados cadastrados no sistema.", "operationId": "BuscaMercado", "tags": ["Mercado"], "responses": { "200": { "description": "Lista de mercado retornada com sucesso", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "nome": { "type": "string", "example": "Confiança" }, "logo": { "type": "string", "example": "https://www.confianca.com.br/logo.svg" } } } } } } }, "500": { "description": "Erro interno ao buscar usuários", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao buscar usuário." } } } } } } } } }, "/loginUsuario": { "post": { "summary": "Realiza o login do usuário", "tags": ["Login"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "example": "usuario@example.com" }, "senha": { "type": "string", "example": "senha123" } }, "required": ["email", "senha"] } } } }, "responses": { "200": { "description": "Usuário autenticado com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "nome": { "type": "string" }, "email": { "type": "string" }, "token": { "type": "string" } } } } } }, "400": { "description": "Usuário ou senha inválidos" } } } }, "/verificaTokenUsuario": { "get": { "summary": "Verifica a autenticidade do token do usuário", "tags": ["Verifica Token"], "security": [ { "BearerAuth": [] } ], "responses": { "200": { "description": "Usuário autenticado", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "nome": { "type": "string" } } } } } }, "400": { "description": "Verificação falhou" } } } }, "/BuscarProdutos": { "post": { "summary": "Busca produtos no supermercado Confiança", "description": "Retorna informações sobre um produto buscado no site do Confiança.", "operationId": "buscaProdutosConfianca", "tags": ["Puppeteer"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "nomeProduto": { "type": "string", "example": "Isotônico Gatorade Limão Frasco 500ml" } }, "required": ["nomeProduto"] } } } }, "responses": { "200": { "description": "Produtos encontrados com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "dadosEncontrados": { "type": "object", "properties": { "nomeProduto": { "type": "string" }, "valorProduto": { "type": "string" }, "imagemProduto": { "type": "string" } } }, "produtosSimilares": { "type": "array", "items": { "type": "object", "properties": { "imageUrl": { "type": "string" }, "title": { "type": "string" }, "price": { "type": "string" } } } } } } } } }, "400": { "description": "Erro na requisição" }, "500": { "description": "Erro interno do servidor" } } } }, "/BuscaPromocoes": { "get": { "summary": "Busca produtos em promoções", "description": "Retorna informações sobre todos os produtos buscados de todos os sites em promoção.", "operationId": "BuscaPromocoes", "tags": ["Puppeteer"], "responses": { "200": { "description": "Produtos encontrados com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "produtos": { "type": "array", "items": { "type": "object", "properties": { "imageUrl": { "type": "string" }, "title": { "type": "string" }, "price": { "type": "string" } } } } } } } } }, "400": { "description": "Erro na requisição" }, "500": { "description": "Erro interno do servidor" } } } }, "/BuscaPromoMercados": { "get": { "summary": "Buscar promoções intercaladas entre mercados", "tags": ["Produtos Promoções"], "responses": { "200": { "description": "Lista de produtos intercalados por mercado", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Produto" } } } } }, "500": { "description": "Erro interno no servidor", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao buscar promoções de mercado." } } } } } } } } }, "/CadastraProduto": { "get": { "summary": "Cadastrar produtos em promoção", "description": "Busca os produtos promocionais dos mercados e cadastra no banco de dados. Esta rota também limpa os produtos antigos antes de cadastrar os novos.", "tags": ["Produtos Promoções"], "responses": { "200": { "description": "Produtos cadastrados com sucesso", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Produtos cadastrados com sucesso!" } } } } } }, "500": { "description": "Erro ao cadastrar os produtos", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Erro ao buscar mercado." } } } } } } } } } } }