- Cria README.md na raiz com visão global e diagrama de arquitetura - Adiciona/atualiza README.md em todos os componentes: - backend (API Go) - backoffice (NestJS) - marketplace (React/Vite) - saveinmed-bff (Python/FastAPI) - saveinmed-frontend (Next.js) - website (Fresh/Deno) - Atualiza .gitignore em todos os componentes com regras abrangentes - Cria .gitignore na raiz do projeto - Renomeia pastas para melhor organização: - backend-go → backend - backend-nest → backoffice - marketplace-front → marketplace - Documenta arquitetura, tecnologias, setup e fluxo de desenvolvimento
479 lines
No EOL
14 KiB
JSON
479 lines
No EOL
14 KiB
JSON
{
|
|
"schemes": [
|
|
"http"
|
|
],
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "API REST B2B para marketplace farmacêutico com split de pagamento e rastreabilidade.",
|
|
"title": "SaveInMed Performance Core API",
|
|
"contact": {
|
|
"name": "Engenharia SaveInMed",
|
|
"email": "devops@saveinmed.com"
|
|
},
|
|
"version": "1.0"
|
|
},
|
|
"basePath": "/",
|
|
"paths": {
|
|
"/api/companies": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Empresas"
|
|
],
|
|
"summary": "Lista empresas",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/domain.Company"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Cadastra farmácia, distribuidora ou administrador com CNPJ e licença sanitária.",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Empresas"
|
|
],
|
|
"summary": "Registro de empresas",
|
|
"parameters": [
|
|
{
|
|
"description": "Dados da empresa",
|
|
"name": "company",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.registerCompanyRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/domain.Company"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/orders": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Pedidos"
|
|
],
|
|
"summary": "Criação de pedido com split",
|
|
"parameters": [
|
|
{
|
|
"description": "Pedido",
|
|
"name": "order",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.createOrderRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/domain.Order"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/orders/{id}": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Pedidos"
|
|
],
|
|
"summary": "Consulta pedido",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Order ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/domain.Order"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/orders/{id}/payment": {
|
|
"post": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Pagamentos"
|
|
],
|
|
"summary": "Cria preferência de pagamento Mercado Pago com split nativo",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Order ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/domain.PaymentPreference"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/orders/{id}/status": {
|
|
"patch": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Pedidos"
|
|
],
|
|
"summary": "Atualiza status do pedido",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Order ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Novo status",
|
|
"name": "status",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.updateStatusRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": ""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/products": {
|
|
"get": {
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Produtos"
|
|
],
|
|
"summary": "Lista catálogo com lote e validade",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/domain.Product"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Produtos"
|
|
],
|
|
"summary": "Cadastro de produto com rastreabilidade de lote",
|
|
"parameters": [
|
|
{
|
|
"description": "Produto",
|
|
"name": "product",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/handler.registerProductRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/domain.Product"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"domain.Company": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cnpj": {
|
|
"type": "string"
|
|
},
|
|
"corporate_name": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"description": "pharmacy, distributor, admin",
|
|
"type": "string"
|
|
},
|
|
"sanitary_license": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"domain.Order": {
|
|
"type": "object",
|
|
"properties": {
|
|
"buyer_id": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/domain.OrderItem"
|
|
}
|
|
},
|
|
"seller_id": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/domain.OrderStatus"
|
|
},
|
|
"total_cents": {
|
|
"type": "integer"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"domain.OrderItem": {
|
|
"type": "object",
|
|
"properties": {
|
|
"batch": {
|
|
"type": "string"
|
|
},
|
|
"expires_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"order_id": {
|
|
"type": "string"
|
|
},
|
|
"product_id": {
|
|
"type": "string"
|
|
},
|
|
"quantity": {
|
|
"type": "integer"
|
|
},
|
|
"unit_cents": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"domain.OrderStatus": {
|
|
"type": "string",
|
|
"enum": [
|
|
"Pendente",
|
|
"Pago",
|
|
"Faturado",
|
|
"Entregue"
|
|
],
|
|
"x-enum-varnames": [
|
|
"OrderStatusPending",
|
|
"OrderStatusPaid",
|
|
"OrderStatusInvoiced",
|
|
"OrderStatusDelivered"
|
|
]
|
|
},
|
|
"domain.PaymentPreference": {
|
|
"type": "object",
|
|
"properties": {
|
|
"commission_pct": {
|
|
"type": "number"
|
|
},
|
|
"gateway": {
|
|
"type": "string"
|
|
},
|
|
"marketplace_fee": {
|
|
"type": "integer"
|
|
},
|
|
"order_id": {
|
|
"type": "string"
|
|
},
|
|
"payment_url": {
|
|
"type": "string"
|
|
},
|
|
"seller_receivable": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"domain.Product": {
|
|
"type": "object",
|
|
"properties": {
|
|
"batch": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"expires_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"price_cents": {
|
|
"type": "integer"
|
|
},
|
|
"seller_id": {
|
|
"type": "string"
|
|
},
|
|
"stock": {
|
|
"type": "integer"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"handler.createOrderRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"buyer_id": {
|
|
"type": "string"
|
|
},
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/domain.OrderItem"
|
|
}
|
|
},
|
|
"seller_id": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"handler.registerCompanyRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cnpj": {
|
|
"type": "string"
|
|
},
|
|
"corporate_name": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"type": "string"
|
|
},
|
|
"sanitary_license": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"handler.registerProductRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"batch": {
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"expires_at": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"price_cents": {
|
|
"type": "integer"
|
|
},
|
|
"seller_id": {
|
|
"type": "string"
|
|
},
|
|
"stock": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"handler.updateStatusRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |