saveinmed/backend/docs/swagger.yaml

2196 lines
53 KiB
YAML

basePath: /
definitions:
github_com_saveinmed_backend-go_internal_domain.CartItem:
properties:
batch:
type: string
buyer_id:
type: string
created_at:
type: string
expires_at:
type: string
id:
type: string
product_id:
type: string
product_name:
type: string
quantity:
type: integer
unit_cents:
type: integer
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.CartSummary:
properties:
discount_cents:
type: integer
discount_reason:
type: string
items:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.CartItem'
type: array
subtotal_cents:
type: integer
total_cents:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.Company:
properties:
category:
description: farmacia, distribuidora
type: string
city:
type: string
cnpj:
type: string
corporate_name:
type: string
created_at:
description: Timestamps
type: string
id:
type: string
is_24_hours:
type: boolean
is_verified:
type: boolean
latitude:
description: Location
type: number
license_number:
type: string
longitude:
type: number
operating_hours:
description: 'e.g. "Seg-Sex: 08:00-18:00, Sab: 08:00-12:00"'
type: string
phone:
description: Contact & Hours
type: string
state:
type: string
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.CompanyRating:
properties:
average_score:
type: number
company_id:
type: string
total_reviews:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.InventoryItem:
properties:
batch:
type: string
expires_at:
type: string
name:
type: string
price_cents:
type: integer
product_id:
type: string
quantity:
type: integer
seller_id:
type: string
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.Order:
properties:
buyer_id:
type: string
created_at:
type: string
id:
type: string
items:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.OrderItem'
type: array
payment_method:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.PaymentMethod'
seller_id:
type: string
shipping:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShippingAddress'
status:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.OrderStatus'
total_cents:
type: integer
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.OrderItem:
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
type: object
github_com_saveinmed_backend-go_internal_domain.OrderStatus:
enum:
- Pendente
- Pago
- Faturado
- Entregue
type: string
x-enum-varnames:
- OrderStatusPending
- OrderStatusPaid
- OrderStatusInvoiced
- OrderStatusDelivered
github_com_saveinmed_backend-go_internal_domain.PaymentMethod:
enum:
- pix
- credit_card
- debit_card
type: string
x-enum-varnames:
- PaymentMethodPix
- PaymentMethodCredit
- PaymentMethodDebit
github_com_saveinmed_backend-go_internal_domain.PaymentPreference:
properties:
commission_pct:
type: number
gateway:
type: string
marketplace_fee:
type: integer
order_id:
type: string
payment_url:
type: string
seller_receivable:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.PaymentSplitResult:
properties:
marketplace_fee:
type: integer
order_id:
type: string
payment_id:
type: string
seller_receivable:
type: integer
status:
type: string
total_paid_amount:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.PaymentWebhookEvent:
properties:
marketplace_fee:
type: integer
order_id:
type: string
payment_id:
type: string
seller_amount:
type: integer
status:
type: string
total_paid_amount:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.Product:
properties:
batch:
type: string
category:
type: string
created_at:
type: string
description:
type: string
ean_code:
type: string
expires_at:
type: string
id:
type: string
manufacturer:
type: string
name:
type: string
observations:
type: string
price_cents:
type: integer
seller_id:
type: string
stock:
type: integer
subcategory:
type: string
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.ProductPaginationResponse:
properties:
current_page:
type: integer
items:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Product'
type: array
total_count:
type: integer
total_pages:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.ProductSearchPage:
properties:
page:
type: integer
page_size:
type: integer
products:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ProductWithDistance'
type: array
total:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.ProductWithDistance:
properties:
batch:
type: string
category:
type: string
created_at:
type: string
description:
type: string
distance_km:
type: number
ean_code:
type: string
expires_at:
type: string
id:
type: string
manufacturer:
type: string
name:
type: string
observations:
type: string
price_cents:
type: integer
seller_id:
type: string
stock:
type: integer
subcategory:
type: string
tenant_city:
type: string
tenant_state:
type: string
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.Review:
properties:
buyer_id:
type: string
comment:
type: string
created_at:
type: string
id:
type: string
order_id:
type: string
rating:
type: integer
seller_id:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.ReviewPage:
properties:
page:
type: integer
page_size:
type: integer
reviews:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Review'
type: array
total:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.Shipment:
properties:
carrier:
type: string
created_at:
type: string
external_tracking:
type: string
id:
type: string
order_id:
type: string
status:
type: string
tracking_code:
type: string
updated_at:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.ShipmentPage:
properties:
page:
type: integer
page_size:
type: integer
shipments:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Shipment'
type: array
total:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.ShippingAddress:
properties:
city:
type: string
complement:
type: string
country:
type: string
district:
type: string
number:
type: string
recipient_name:
type: string
state:
type: string
street:
type: string
zip_code:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.ShippingOption:
properties:
description:
type: string
distance_km:
type: number
estimated_minutes:
type: integer
type:
type: string
value_cents:
type: integer
type: object
github_com_saveinmed_backend-go_internal_domain.ShippingSettings:
properties:
active:
type: boolean
created_at:
type: string
free_shipping_threshold_cents:
type: integer
latitude:
type: number
longitude:
type: number
max_radius_km:
type: number
min_fee_cents:
type: integer
pickup_active:
type: boolean
pickup_address:
type: string
pickup_hours:
type: string
price_per_km_cents:
type: integer
updated_at:
type: string
vendor_id:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.User:
properties:
company_id:
type: string
created_at:
type: string
email:
type: string
email_verified:
type: boolean
id:
type: string
name:
type: string
role:
type: string
updated_at:
type: string
username:
type: string
type: object
github_com_saveinmed_backend-go_internal_domain.UserPage:
properties:
page:
type: integer
page_size:
type: integer
total:
type: integer
users:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.User'
type: array
type: object
internal_http_handler.addCartItemRequest:
properties:
product_id:
type: string
quantity:
type: integer
type: object
internal_http_handler.authResponse:
properties:
expires_at:
type: string
token:
type: string
type: object
internal_http_handler.createOrderRequest:
properties:
buyer_id:
type: string
items:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.OrderItem'
type: array
payment_method:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.PaymentMethod'
seller_id:
type: string
shipping:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShippingAddress'
type: object
internal_http_handler.createReviewRequest:
properties:
comment:
type: string
order_id:
type: string
rating:
type: integer
type: object
internal_http_handler.createShipmentRequest:
properties:
carrier:
type: string
external_tracking:
type: string
order_id:
type: string
tracking_code:
type: string
type: object
internal_http_handler.createUserRequest:
properties:
company_id:
type: string
email:
type: string
name:
type: string
password:
type: string
role:
type: string
username:
type: string
type: object
internal_http_handler.forgotPasswordRequest:
properties:
email:
type: string
type: object
internal_http_handler.inventoryAdjustRequest:
properties:
delta:
type: integer
product_id:
type: string
reason:
type: string
type: object
internal_http_handler.loginRequest:
properties:
email:
type: string
password:
type: string
username:
type: string
type: object
internal_http_handler.messageResponse:
properties:
message:
type: string
type: object
internal_http_handler.registerAuthRequest:
properties:
company:
$ref: '#/definitions/internal_http_handler.registerCompanyTarget'
company_id:
type: string
email:
type: string
name:
type: string
password:
type: string
role:
type: string
username:
type: string
type: object
internal_http_handler.registerCompanyRequest:
properties:
category:
type: string
city:
type: string
cnpj:
type: string
corporate_name:
type: string
latitude:
type: number
license_number:
type: string
longitude:
type: number
state:
type: string
type: object
internal_http_handler.registerCompanyTarget:
properties:
category:
type: string
city:
type: string
cnpj:
type: string
corporate_name:
type: string
id:
type: string
latitude:
type: number
license_number:
type: string
longitude:
type: number
state:
type: string
type: object
internal_http_handler.registerProductRequest:
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
type: object
internal_http_handler.resetPasswordRequest:
properties:
password:
type: string
token:
type: string
type: object
internal_http_handler.resetTokenResponse:
properties:
expires_at:
type: string
message:
type: string
reset_token:
type: string
type: object
internal_http_handler.shippingCalculateRequest:
properties:
address_id:
type: string
buyer_latitude:
type: number
buyer_longitude:
type: number
cart_total_cents:
type: integer
postal_code:
type: string
vendor_id:
type: string
type: object
internal_http_handler.shippingSettingsRequest:
properties:
active:
type: boolean
free_shipping_threshold_cents:
type: integer
latitude:
description: Store location for radius calc
type: number
longitude:
type: number
max_radius_km:
type: number
min_fee_cents:
type: integer
pickup_active:
type: boolean
pickup_address:
type: string
pickup_hours:
type: string
price_per_km_cents:
type: integer
type: object
internal_http_handler.updateCompanyRequest:
properties:
category:
type: string
city:
type: string
cnpj:
type: string
corporate_name:
type: string
is_verified:
type: boolean
latitude:
type: number
license_number:
type: string
longitude:
type: number
state:
type: string
type: object
internal_http_handler.updateProductRequest:
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
type: object
internal_http_handler.updateStatusRequest:
properties:
status:
type: string
type: object
internal_http_handler.updateUserRequest:
properties:
company_id:
type: string
email:
type: string
name:
type: string
password:
type: string
role:
type: string
username:
type: string
type: object
internal_http_handler.verifyEmailRequest:
properties:
token:
type: string
type: object
info:
contact:
email: devops@saveinmed.com
name: Engenharia SaveInMed
description: API REST B2B para marketplace farmacêutico com split de pagamento e
rastreabilidade.
title: SaveInMed Performance Core API
version: "1.0"
paths:
/api/v1/auth/login:
post:
consumes:
- application/json
description: Autentica usuário e retorna token JWT.
parameters:
- description: Credenciais
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.loginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_http_handler.authResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Login
tags:
- Autenticação
/api/v1/auth/logout:
post:
description: Endpoint para logout (invalidação client-side).
responses:
"204":
description: No Content
schema:
type: string
summary: Logout
tags:
- Autenticação
/api/v1/auth/password/forgot:
post:
consumes:
- application/json
description: Gera um token de redefinição de senha.
parameters:
- description: Email do usuário
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.forgotPasswordRequest'
produces:
- application/json
responses:
"202":
description: Accepted
schema:
$ref: '#/definitions/internal_http_handler.resetTokenResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
summary: Solicitar redefinição de senha
tags:
- Autenticação
/api/v1/auth/password/reset:
post:
consumes:
- application/json
description: Atualiza a senha usando o token de redefinição.
parameters:
- description: Token e nova senha
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.resetPasswordRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_http_handler.messageResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Redefinir senha
tags:
- Autenticação
/api/v1/auth/refresh-token:
post:
consumes:
- application/json
description: Gera um novo JWT a partir de um token válido.
parameters:
- description: Bearer token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_http_handler.authResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Atualizar token
tags:
- Autenticação
/api/v1/auth/register:
post:
consumes:
- application/json
description: Cria um usuário e opcionalmente uma empresa, retornando token JWT.
parameters:
- description: Dados do usuário e empresa
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.registerAuthRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/internal_http_handler.authResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Cadastro de usuário
tags:
- Autenticação
/api/v1/auth/register/customer:
post:
consumes:
- application/json
description: Cria um usuário do tipo cliente e opcionalmente uma empresa, retornando
token JWT.
parameters:
- description: Dados do usuário e empresa
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.registerAuthRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/internal_http_handler.authResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Cadastro de cliente
tags:
- Autenticação
/api/v1/auth/register/tenant:
post:
consumes:
- application/json
description: Cria um usuário do tipo tenant e opcionalmente uma empresa, retornando
token JWT.
parameters:
- description: Dados do usuário e empresa
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.registerAuthRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/internal_http_handler.authResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Cadastro de tenant
tags:
- Autenticação
/api/v1/auth/verify-email:
post:
consumes:
- application/json
description: Marca o email como verificado usando um token JWT.
parameters:
- description: Token de verificação
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.verifyEmailRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_http_handler.messageResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Verificar email
tags:
- Autenticação
/api/v1/cart:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.CartSummary'
security:
- BearerAuth: []
summary: Obter carrinho
tags:
- Carrinho
post:
consumes:
- application/json
parameters:
- description: Item do carrinho
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.addCartItemRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.CartSummary'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Adicionar item ao carrinho
tags:
- Carrinho
/api/v1/cart/{id}:
delete:
parameters:
- description: Cart item ID
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.CartSummary'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Remover item do carrinho
tags:
- Carrinho
/api/v1/companies:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
type: array
summary: Lista empresas
tags:
- Empresas
post:
consumes:
- application/json
description: Cadastra farmácia, distribuidora ou administrador com CNPJ e licença
sanitária.
parameters:
- description: Dados da empresa
in: body
name: company
required: true
schema:
$ref: '#/definitions/internal_http_handler.registerCompanyRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
summary: Registro de empresas
tags:
- Empresas
/api/v1/companies/{id}:
delete:
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
responses:
"204":
description: ""
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Remover empresa
tags:
- Empresas
get:
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Obter empresa
tags:
- Empresas
patch:
consumes:
- application/json
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
- description: Campos para atualização
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.updateCompanyRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Atualizar empresa
tags:
- Empresas
/api/v1/companies/{id}/rating:
get:
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.CompanyRating'
summary: Obter avaliação da empresa
tags:
- Empresas
/api/v1/companies/{id}/verify:
patch:
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
security:
- BearerAuth: []
summary: Verificar empresa
tags:
- Empresas
/api/v1/companies/me:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Company'
security:
- BearerAuth: []
summary: Obter minha empresa
tags:
- Empresas
/api/v1/dashboard:
get:
description: Get dashboard data for the authenticated user (Admin or Seller)
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get dashboard data
tags:
- Dashboard
/api/v1/inventory:
get:
parameters:
- description: Dias para expiração
in: query
name: expires_in_days
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.InventoryItem'
type: array
security:
- BearerAuth: []
summary: Listar estoque
tags:
- Estoque
/api/v1/inventory/adjust:
post:
consumes:
- application/json
parameters:
- description: Ajuste de estoque
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.inventoryAdjustRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.InventoryItem'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Ajustar estoque
tags:
- Estoque
/api/v1/marketplace/records:
get:
parameters:
- description: Busca textual
in: query
name: query
type: string
- description: Campo de ordenação (created_at|updated_at)
in: query
name: sort_by
type: string
- description: Direção (asc|desc)
in: query
name: sort_order
type: string
- description: Data mínima (RFC3339)
in: query
name: created_after
type: string
- description: Data máxima (RFC3339)
in: query
name: created_before
type: string
- description: Página
in: query
name: page
type: integer
- description: Itens por página
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ProductPaginationResponse'
summary: Busca avançada no marketplace
tags:
- Marketplace
/api/v1/orders:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Order'
type: array
security:
- BearerAuth: []
summary: Listar pedidos
tags:
- Pedidos
post:
consumes:
- application/json
parameters:
- description: Pedido
in: body
name: order
required: true
schema:
$ref: '#/definitions/internal_http_handler.createOrderRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Order'
summary: Criação de pedido com split
tags:
- Pedidos
/api/v1/orders/{id}:
delete:
parameters:
- description: Order ID
in: path
name: id
required: true
type: string
responses:
"204":
description: ""
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Remover pedido
tags:
- Pedidos
get:
parameters:
- description: Order ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Order'
security:
- BearerAuth: []
summary: Consulta pedido
tags:
- Pedidos
/api/v1/orders/{id}/payment:
post:
parameters:
- description: Order ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.PaymentPreference'
security:
- BearerAuth: []
summary: Cria preferência de pagamento Mercado Pago com split nativo
tags:
- Pagamentos
/api/v1/orders/{id}/status:
patch:
consumes:
- application/json
parameters:
- description: Order ID
in: path
name: id
required: true
type: string
- description: Novo status
in: body
name: status
required: true
schema:
$ref: '#/definitions/internal_http_handler.updateStatusRequest'
produces:
- application/json
responses:
"204":
description: ""
security:
- BearerAuth: []
summary: Atualiza status do pedido
tags:
- Pedidos
/api/v1/payments/webhook:
post:
consumes:
- application/json
parameters:
- description: Evento do gateway
in: body
name: notification
required: true
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.PaymentWebhookEvent'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.PaymentSplitResult'
summary: Recebe notificações do Mercado Pago
tags:
- Pagamentos
/api/v1/products:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Product'
type: array
summary: Lista catálogo com lote e validade
tags:
- Produtos
post:
consumes:
- application/json
parameters:
- description: Produto
in: body
name: product
required: true
schema:
$ref: '#/definitions/internal_http_handler.registerProductRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Product'
summary: Cadastro de produto com rastreabilidade de lote
tags:
- Produtos
/api/v1/products/{id}:
delete:
parameters:
- description: Product ID
in: path
name: id
required: true
type: string
responses:
"204":
description: ""
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Remover produto
tags:
- Produtos
get:
parameters:
- description: Product ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Product'
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Obter produto
tags:
- Produtos
patch:
consumes:
- application/json
parameters:
- description: Product ID
in: path
name: id
required: true
type: string
- description: Campos para atualização
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.updateProductRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Product'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Atualizar produto
tags:
- Produtos
/api/v1/products/search:
get:
description: Retorna produtos ordenados por validade, com distância aproximada.
Vendedor anônimo até checkout.
parameters:
- description: Termo de busca
in: query
name: search
type: string
- description: Preço mínimo em centavos
in: query
name: min_price
type: integer
- description: Preço máximo em centavos
in: query
name: max_price
type: integer
- description: Distância máxima em km
in: query
name: max_distance
type: number
- description: Latitude do comprador
in: query
name: lat
required: true
type: number
- description: Longitude do comprador
in: query
name: lng
required: true
type: number
- description: Página
in: query
name: page
type: integer
- description: Itens por página
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ProductSearchPage'
summary: Busca avançada de produtos com filtros e distância
tags:
- Produtos
/api/v1/reviews:
get:
description: Returns reviews. Admins see all, Tenants see only their own.
parameters:
- description: Página
in: query
name: page
type: integer
- description: Tamanho da página
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ReviewPage'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: List reviews
tags:
- Reviews
post:
consumes:
- application/json
parameters:
- description: Dados da avaliação
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.createReviewRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Review'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Criar avaliação
tags:
- Avaliações
/api/v1/shipments:
get:
description: Returns shipments. Admins see all, Tenants see only their own.
parameters:
- description: Página
in: query
name: page
type: integer
- description: Tamanho da página
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShipmentPage'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: List shipments
tags:
- Shipments
post:
consumes:
- application/json
parameters:
- description: Dados de envio
in: body
name: shipment
required: true
schema:
$ref: '#/definitions/internal_http_handler.createShipmentRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Shipment'
security:
- BearerAuth: []
summary: Gera guia de postagem/transporte
tags:
- Logistica
/api/v1/shipments/{order_id}:
get:
parameters:
- description: Order ID
in: path
name: order_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.Shipment'
security:
- BearerAuth: []
summary: Rastreia entrega
tags:
- Logistica
/api/v1/shipping/calculate:
post:
consumes:
- application/json
description: Calculates shipping or pickup options based on vendor config and
buyer location.
parameters:
- description: Calculation inputs
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.shippingCalculateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShippingOption'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Calculate shipping options
tags:
- Shipping
/api/v1/shipping/settings/{vendor_id}:
get:
description: Returns pickup and delivery settings for a vendor.
parameters:
- description: Vendor ID
in: path
name: vendor_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShippingSettings'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get vendor shipping settings
tags:
- Shipping
put:
consumes:
- application/json
description: Stores pickup and delivery settings for a vendor.
parameters:
- description: Vendor ID
in: path
name: vendor_id
required: true
type: string
- description: Shipping settings
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.shippingSettingsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.ShippingSettings'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Update vendor shipping settings
tags:
- Shipping
/api/v1/users:
get:
parameters:
- description: Página
in: query
name: page
type: integer
- description: Tamanho da página
in: query
name: page_size
type: integer
- description: Filtro por empresa
in: query
name: company_id
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.UserPage'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Listar usuários
tags:
- Usuários
post:
consumes:
- application/json
parameters:
- description: Novo usuário
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.createUserRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.User'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Criar usuário
tags:
- Usuários
/api/v1/users/{id}:
delete:
parameters:
- description: User ID
in: path
name: id
required: true
type: string
responses:
"204":
description: No Content
schema:
type: string
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Excluir usuário
tags:
- Usuários
get:
parameters:
- description: User ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.User'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Obter usuário
tags:
- Usuários
put:
consumes:
- application/json
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: Campos para atualização
in: body
name: payload
required: true
schema:
$ref: '#/definitions/internal_http_handler.updateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_saveinmed_backend-go_internal_domain.User'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Atualizar usuário
tags:
- Usuários
schemes:
- http
securityDefinitions:
BearerAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0"