Add v1 prefix to API routes
This commit is contained in:
parent
21d98da9c1
commit
69af774d30
5 changed files with 56 additions and 56 deletions
|
|
@ -18,7 +18,7 @@ const docTemplate = `{
|
||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/companies": {
|
"/api/v1/companies": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -72,7 +72,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/companies/{id}": {
|
"/api/v1/companies/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -203,7 +203,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders": {
|
"/api/v1/orders": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -261,7 +261,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}": {
|
"/api/v1/orders/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -337,7 +337,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}/payment": {
|
"/api/v1/orders/{id}/payment": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -370,7 +370,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}/status": {
|
"/api/v1/orders/{id}/status": {
|
||||||
"patch": {
|
"patch": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -412,7 +412,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/products": {
|
"/api/v1/products": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -465,7 +465,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/products/{id}": {
|
"/api/v1/products/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
"basePath": "/",
|
"basePath": "/",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/companies": {
|
"/api/v1/companies": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/companies/{id}": {
|
"/api/v1/companies/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -199,7 +199,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders": {
|
"/api/v1/orders": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -257,7 +257,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}": {
|
"/api/v1/orders/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -333,7 +333,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}/payment": {
|
"/api/v1/orders/{id}/payment": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -366,7 +366,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/orders/{id}/status": {
|
"/api/v1/orders/{id}/status": {
|
||||||
"patch": {
|
"patch": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -408,7 +408,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/products": {
|
"/api/v1/products": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
@ -461,7 +461,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/products/{id}": {
|
"/api/v1/products/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,7 @@ info:
|
||||||
title: SaveInMed Performance Core API
|
title: SaveInMed Performance Core API
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
paths:
|
paths:
|
||||||
/api/companies:
|
/api/v1/companies:
|
||||||
get:
|
get:
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -555,7 +555,7 @@ paths:
|
||||||
summary: Registro de empresas
|
summary: Registro de empresas
|
||||||
tags:
|
tags:
|
||||||
- Empresas
|
- Empresas
|
||||||
/api/companies/{id}:
|
/api/v1/companies/{id}:
|
||||||
delete:
|
delete:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Company ID
|
- description: Company ID
|
||||||
|
|
@ -641,7 +641,7 @@ paths:
|
||||||
summary: Atualizar empresa
|
summary: Atualizar empresa
|
||||||
tags:
|
tags:
|
||||||
- Empresas
|
- Empresas
|
||||||
/api/orders:
|
/api/v1/orders:
|
||||||
get:
|
get:
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -677,7 +677,7 @@ paths:
|
||||||
summary: Criação de pedido com split
|
summary: Criação de pedido com split
|
||||||
tags:
|
tags:
|
||||||
- Pedidos
|
- Pedidos
|
||||||
/api/orders/{id}:
|
/api/v1/orders/{id}:
|
||||||
delete:
|
delete:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Order ID
|
- description: Order ID
|
||||||
|
|
@ -724,7 +724,7 @@ paths:
|
||||||
summary: Consulta pedido
|
summary: Consulta pedido
|
||||||
tags:
|
tags:
|
||||||
- Pedidos
|
- Pedidos
|
||||||
/api/orders/{id}/payment:
|
/api/v1/orders/{id}/payment:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Order ID
|
- description: Order ID
|
||||||
|
|
@ -744,7 +744,7 @@ paths:
|
||||||
summary: Cria preferência de pagamento Mercado Pago com split nativo
|
summary: Cria preferência de pagamento Mercado Pago com split nativo
|
||||||
tags:
|
tags:
|
||||||
- Pagamentos
|
- Pagamentos
|
||||||
/api/orders/{id}/status:
|
/api/v1/orders/{id}/status:
|
||||||
patch:
|
patch:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -770,7 +770,7 @@ paths:
|
||||||
summary: Atualiza status do pedido
|
summary: Atualiza status do pedido
|
||||||
tags:
|
tags:
|
||||||
- Pedidos
|
- Pedidos
|
||||||
/api/products:
|
/api/v1/products:
|
||||||
get:
|
get:
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -804,7 +804,7 @@ paths:
|
||||||
summary: Cadastro de produto com rastreabilidade de lote
|
summary: Cadastro de produto com rastreabilidade de lote
|
||||||
tags:
|
tags:
|
||||||
- Produtos
|
- Produtos
|
||||||
/api/products/{id}:
|
/api/v1/products/{id}:
|
||||||
delete:
|
delete:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Product ID
|
- description: Product ID
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ func (h *Handler) Login(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param company body registerCompanyRequest true "Dados da empresa"
|
// @Param company body registerCompanyRequest true "Dados da empresa"
|
||||||
// @Success 201 {object} domain.Company
|
// @Success 201 {object} domain.Company
|
||||||
// @Router /api/companies [post]
|
// @Router /api/v1/companies [post]
|
||||||
// @Router /api/v1/companies [post]
|
// @Router /api/v1/companies [post]
|
||||||
func (h *Handler) CreateCompany(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) CreateCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
var req registerCompanyRequest
|
var req registerCompanyRequest
|
||||||
|
|
@ -151,7 +151,7 @@ func (h *Handler) CreateCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Tags Empresas
|
// @Tags Empresas
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} domain.Company
|
// @Success 200 {array} domain.Company
|
||||||
// @Router /api/companies [get]
|
// @Router /api/v1/companies [get]
|
||||||
// @Router /api/v1/companies [get]
|
// @Router /api/v1/companies [get]
|
||||||
func (h *Handler) ListCompanies(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ListCompanies(w http.ResponseWriter, r *http.Request) {
|
||||||
companies, err := h.svc.ListCompanies(r.Context())
|
companies, err := h.svc.ListCompanies(r.Context())
|
||||||
|
|
@ -169,7 +169,7 @@ func (h *Handler) ListCompanies(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Param id path string true "Company ID"
|
// @Param id path string true "Company ID"
|
||||||
// @Success 200 {object} domain.Company
|
// @Success 200 {object} domain.Company
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/companies/{id} [get]
|
// @Router /api/v1/companies/{id} [get]
|
||||||
// @Router /api/v1/companies/{id} [get]
|
// @Router /api/v1/companies/{id} [get]
|
||||||
func (h *Handler) GetCompany(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) GetCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -197,7 +197,7 @@ func (h *Handler) GetCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Success 200 {object} domain.Company
|
// @Success 200 {object} domain.Company
|
||||||
// @Failure 400 {object} map[string]string
|
// @Failure 400 {object} map[string]string
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/companies/{id} [patch]
|
// @Router /api/v1/companies/{id} [patch]
|
||||||
// @Router /api/v1/companies/{id} [patch]
|
// @Router /api/v1/companies/{id} [patch]
|
||||||
func (h *Handler) UpdateCompany(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) UpdateCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -249,7 +249,7 @@ func (h *Handler) UpdateCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Success 204 ""
|
// @Success 204 ""
|
||||||
// @Failure 400 {object} map[string]string
|
// @Failure 400 {object} map[string]string
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/companies/{id} [delete]
|
// @Router /api/v1/companies/{id} [delete]
|
||||||
// @Router /api/v1/companies/{id} [delete]
|
// @Router /api/v1/companies/{id} [delete]
|
||||||
func (h *Handler) DeleteCompany(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) DeleteCompany(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -355,7 +355,7 @@ func (h *Handler) GetCompanyRating(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param product body registerProductRequest true "Produto"
|
// @Param product body registerProductRequest true "Produto"
|
||||||
// @Success 201 {object} domain.Product
|
// @Success 201 {object} domain.Product
|
||||||
// @Router /api/products [post]
|
// @Router /api/v1/products [post]
|
||||||
// @Router /api/v1/products [post]
|
// @Router /api/v1/products [post]
|
||||||
func (h *Handler) CreateProduct(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) CreateProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
var req registerProductRequest
|
var req registerProductRequest
|
||||||
|
|
@ -387,7 +387,7 @@ func (h *Handler) CreateProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Tags Produtos
|
// @Tags Produtos
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} domain.Product
|
// @Success 200 {array} domain.Product
|
||||||
// @Router /api/products [get]
|
// @Router /api/v1/products [get]
|
||||||
// @Router /api/v1/products [get]
|
// @Router /api/v1/products [get]
|
||||||
func (h *Handler) ListProducts(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ListProducts(w http.ResponseWriter, r *http.Request) {
|
||||||
products, err := h.svc.ListProducts(r.Context())
|
products, err := h.svc.ListProducts(r.Context())
|
||||||
|
|
@ -405,7 +405,7 @@ func (h *Handler) ListProducts(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Param id path string true "Product ID"
|
// @Param id path string true "Product ID"
|
||||||
// @Success 200 {object} domain.Product
|
// @Success 200 {object} domain.Product
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/products/{id} [get]
|
// @Router /api/v1/products/{id} [get]
|
||||||
// @Router /api/v1/products/{id} [get]
|
// @Router /api/v1/products/{id} [get]
|
||||||
func (h *Handler) GetProduct(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) GetProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -433,7 +433,7 @@ func (h *Handler) GetProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Success 200 {object} domain.Product
|
// @Success 200 {object} domain.Product
|
||||||
// @Failure 400 {object} map[string]string
|
// @Failure 400 {object} map[string]string
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/products/{id} [patch]
|
// @Router /api/v1/products/{id} [patch]
|
||||||
// @Router /api/v1/products/{id} [patch]
|
// @Router /api/v1/products/{id} [patch]
|
||||||
func (h *Handler) UpdateProduct(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) UpdateProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -491,7 +491,7 @@ func (h *Handler) UpdateProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Success 204 ""
|
// @Success 204 ""
|
||||||
// @Failure 400 {object} map[string]string
|
// @Failure 400 {object} map[string]string
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/products/{id} [delete]
|
// @Router /api/v1/products/{id} [delete]
|
||||||
// @Router /api/v1/products/{id} [delete]
|
// @Router /api/v1/products/{id} [delete]
|
||||||
func (h *Handler) DeleteProduct(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) DeleteProduct(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -577,7 +577,7 @@ func (h *Handler) AdjustInventory(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param order body createOrderRequest true "Pedido"
|
// @Param order body createOrderRequest true "Pedido"
|
||||||
// @Success 201 {object} domain.Order
|
// @Success 201 {object} domain.Order
|
||||||
// @Router /api/orders [post]
|
// @Router /api/v1/orders [post]
|
||||||
// @Router /api/v1/orders [post]
|
// @Router /api/v1/orders [post]
|
||||||
func (h *Handler) CreateOrder(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) CreateOrder(w http.ResponseWriter, r *http.Request) {
|
||||||
var req createOrderRequest
|
var req createOrderRequest
|
||||||
|
|
@ -613,7 +613,7 @@ func (h *Handler) CreateOrder(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} domain.Order
|
// @Success 200 {array} domain.Order
|
||||||
// @Router /api/orders [get]
|
// @Router /api/v1/orders [get]
|
||||||
// @Router /api/v1/orders [get]
|
// @Router /api/v1/orders [get]
|
||||||
func (h *Handler) ListOrders(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ListOrders(w http.ResponseWriter, r *http.Request) {
|
||||||
orders, err := h.svc.ListOrders(r.Context())
|
orders, err := h.svc.ListOrders(r.Context())
|
||||||
|
|
@ -632,7 +632,7 @@ func (h *Handler) ListOrders(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param id path string true "Order ID"
|
// @Param id path string true "Order ID"
|
||||||
// @Success 200 {object} domain.Order
|
// @Success 200 {object} domain.Order
|
||||||
// @Router /api/orders/{id} [get]
|
// @Router /api/v1/orders/{id} [get]
|
||||||
// @Router /api/v1/orders/{id} [get]
|
// @Router /api/v1/orders/{id} [get]
|
||||||
func (h *Handler) GetOrder(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) GetOrder(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -659,7 +659,7 @@ func (h *Handler) GetOrder(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Param id path string true "Order ID"
|
// @Param id path string true "Order ID"
|
||||||
// @Param status body updateStatusRequest true "Novo status"
|
// @Param status body updateStatusRequest true "Novo status"
|
||||||
// @Success 204 ""
|
// @Success 204 ""
|
||||||
// @Router /api/orders/{id}/status [patch]
|
// @Router /api/v1/orders/{id}/status [patch]
|
||||||
// @Router /api/v1/orders/{id}/status [patch]
|
// @Router /api/v1/orders/{id}/status [patch]
|
||||||
func (h *Handler) UpdateOrderStatus(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) UpdateOrderStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -695,7 +695,7 @@ func (h *Handler) UpdateOrderStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Success 204 ""
|
// @Success 204 ""
|
||||||
// @Failure 400 {object} map[string]string
|
// @Failure 400 {object} map[string]string
|
||||||
// @Failure 404 {object} map[string]string
|
// @Failure 404 {object} map[string]string
|
||||||
// @Router /api/orders/{id} [delete]
|
// @Router /api/v1/orders/{id} [delete]
|
||||||
// @Router /api/v1/orders/{id} [delete]
|
// @Router /api/v1/orders/{id} [delete]
|
||||||
func (h *Handler) DeleteOrder(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) DeleteOrder(w http.ResponseWriter, r *http.Request) {
|
||||||
id, err := parseUUIDFromPath(r.URL.Path)
|
id, err := parseUUIDFromPath(r.URL.Path)
|
||||||
|
|
@ -839,7 +839,7 @@ func (h *Handler) DeleteCartItem(w http.ResponseWriter, r *http.Request) {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param id path string true "Order ID"
|
// @Param id path string true "Order ID"
|
||||||
// @Success 201 {object} domain.PaymentPreference
|
// @Success 201 {object} domain.PaymentPreference
|
||||||
// @Router /api/orders/{id}/payment [post]
|
// @Router /api/v1/orders/{id}/payment [post]
|
||||||
// @Router /api/v1/orders/{id}/payment [post]
|
// @Router /api/v1/orders/{id}/payment [post]
|
||||||
func (h *Handler) CreatePaymentPreference(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) CreatePaymentPreference(w http.ResponseWriter, r *http.Request) {
|
||||||
if !strings.HasSuffix(r.URL.Path, "/payment") {
|
if !strings.HasSuffix(r.URL.Path, "/payment") {
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ func New(cfg config.Config) (*Server, error) {
|
||||||
auth := middleware.RequireAuth([]byte(cfg.JWTSecret))
|
auth := middleware.RequireAuth([]byte(cfg.JWTSecret))
|
||||||
adminOnly := middleware.RequireAuth([]byte(cfg.JWTSecret), "Admin")
|
adminOnly := middleware.RequireAuth([]byte(cfg.JWTSecret), "Admin")
|
||||||
|
|
||||||
mux.Handle("POST /api/companies", chain(http.HandlerFunc(h.CreateCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("POST /api/v1/companies", chain(http.HandlerFunc(h.CreateCompany), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/companies", chain(http.HandlerFunc(h.ListCompanies), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/companies", chain(http.HandlerFunc(h.ListCompanies), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/companies/", chain(http.HandlerFunc(h.GetCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/companies/", chain(http.HandlerFunc(h.GetCompany), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("PATCH /api/companies/", chain(http.HandlerFunc(h.UpdateCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("PATCH /api/v1/companies/", chain(http.HandlerFunc(h.UpdateCompany), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("DELETE /api/companies/", chain(http.HandlerFunc(h.DeleteCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("DELETE /api/v1/companies/", chain(http.HandlerFunc(h.DeleteCompany), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("POST /api/v1/companies", chain(http.HandlerFunc(h.CreateCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("POST /api/v1/companies", chain(http.HandlerFunc(h.CreateCompany), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/v1/companies", chain(http.HandlerFunc(h.ListCompanies), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/companies", chain(http.HandlerFunc(h.ListCompanies), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/v1/companies/", chain(http.HandlerFunc(h.GetCompany), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/companies/", chain(http.HandlerFunc(h.GetCompany), middleware.Logger, middleware.Gzip))
|
||||||
|
|
@ -76,11 +76,11 @@ func New(cfg config.Config) (*Server, error) {
|
||||||
mux.Handle("GET /api/v1/companies/me", chain(http.HandlerFunc(h.GetMyCompany), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/companies/me", chain(http.HandlerFunc(h.GetMyCompany), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("GET /api/v1/companies/", chain(http.HandlerFunc(h.GetCompanyRating), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/companies/", chain(http.HandlerFunc(h.GetCompanyRating), middleware.Logger, middleware.Gzip))
|
||||||
|
|
||||||
mux.Handle("POST /api/products", chain(http.HandlerFunc(h.CreateProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("POST /api/v1/products", chain(http.HandlerFunc(h.CreateProduct), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/products", chain(http.HandlerFunc(h.ListProducts), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/products", chain(http.HandlerFunc(h.ListProducts), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/products/", chain(http.HandlerFunc(h.GetProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/products/", chain(http.HandlerFunc(h.GetProduct), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("PATCH /api/products/", chain(http.HandlerFunc(h.UpdateProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("PATCH /api/v1/products/", chain(http.HandlerFunc(h.UpdateProduct), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("DELETE /api/products/", chain(http.HandlerFunc(h.DeleteProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("DELETE /api/v1/products/", chain(http.HandlerFunc(h.DeleteProduct), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("POST /api/v1/products", chain(http.HandlerFunc(h.CreateProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("POST /api/v1/products", chain(http.HandlerFunc(h.CreateProduct), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/v1/products", chain(http.HandlerFunc(h.ListProducts), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/products", chain(http.HandlerFunc(h.ListProducts), middleware.Logger, middleware.Gzip))
|
||||||
mux.Handle("GET /api/v1/products/", chain(http.HandlerFunc(h.GetProduct), middleware.Logger, middleware.Gzip))
|
mux.Handle("GET /api/v1/products/", chain(http.HandlerFunc(h.GetProduct), middleware.Logger, middleware.Gzip))
|
||||||
|
|
@ -90,12 +90,12 @@ func New(cfg config.Config) (*Server, error) {
|
||||||
mux.Handle("GET /api/v1/inventory", chain(http.HandlerFunc(h.ListInventory), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/inventory", chain(http.HandlerFunc(h.ListInventory), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("POST /api/v1/inventory/adjust", chain(http.HandlerFunc(h.AdjustInventory), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("POST /api/v1/inventory/adjust", chain(http.HandlerFunc(h.AdjustInventory), middleware.Logger, middleware.Gzip, auth))
|
||||||
|
|
||||||
mux.Handle("POST /api/orders", chain(http.HandlerFunc(h.CreateOrder), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("POST /api/v1/orders", chain(http.HandlerFunc(h.CreateOrder), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("GET /api/orders", chain(http.HandlerFunc(h.ListOrders), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/orders", chain(http.HandlerFunc(h.ListOrders), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("GET /api/orders/", chain(http.HandlerFunc(h.GetOrder), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/orders/", chain(http.HandlerFunc(h.GetOrder), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("PATCH /api/orders/", chain(http.HandlerFunc(h.UpdateOrderStatus), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("PATCH /api/v1/orders/", chain(http.HandlerFunc(h.UpdateOrderStatus), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("DELETE /api/orders/", chain(http.HandlerFunc(h.DeleteOrder), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("DELETE /api/v1/orders/", chain(http.HandlerFunc(h.DeleteOrder), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("POST /api/orders/", chain(http.HandlerFunc(h.CreatePaymentPreference), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("POST /api/v1/orders/", chain(http.HandlerFunc(h.CreatePaymentPreference), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("POST /api/v1/orders", chain(http.HandlerFunc(h.CreateOrder), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("POST /api/v1/orders", chain(http.HandlerFunc(h.CreateOrder), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("GET /api/v1/orders", chain(http.HandlerFunc(h.ListOrders), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/orders", chain(http.HandlerFunc(h.ListOrders), middleware.Logger, middleware.Gzip, auth))
|
||||||
mux.Handle("GET /api/v1/orders/", chain(http.HandlerFunc(h.GetOrder), middleware.Logger, middleware.Gzip, auth))
|
mux.Handle("GET /api/v1/orders/", chain(http.HandlerFunc(h.GetOrder), middleware.Logger, middleware.Gzip, auth))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue