api-entities/http/catalog.go

47 lines
1021 B
Go
Raw Normal View History

2022-12-18 20:51:26 +01:00
package http
2022-12-23 08:37:21 +01:00
import (
"time"
)
type GetProductRequest struct {
ProductID int `json:"product_id"`
}
type GetProductResponse struct {
2022-12-23 09:33:13 +01:00
ID int `json:"id"`
PID string `json:"pid"`
Name string `json:"name"`
Price float64 `json:"price"`
CreatedAt time.Duration `json:"created_at"`
UpdatedAt time.Duration `json:"updated_at,omitempty"`
2022-12-23 08:37:21 +01:00
}
type GetProductListRequest struct {
CategoryID int `json:"category_id"`
}
type GetProductListResponse struct {
2022-12-23 09:36:40 +01:00
Products []GetProductResponse `json:"-"`
2022-12-23 08:37:21 +01:00
}
2022-12-18 20:51:26 +01:00
type AddProductToBasketRequest struct {
ProductID int `json:"product_id"`
2022-12-20 16:07:56 +01:00
Quantity int `json:"quantity"`
2022-12-18 20:51:26 +01:00
}
2022-12-20 11:14:52 +01:00
type AddProductToBasketResponse struct {
2022-12-20 11:22:24 +01:00
ProductID int `json:"product_id"`
BasketID string `json:"basket_id"`
2022-12-18 20:51:26 +01:00
}
type RemoveProductFromBasketRequest struct {
ProductID int `json:"product_id"`
2022-12-20 16:07:56 +01:00
Quantity int `json:"quantity"`
2022-12-18 20:51:26 +01:00
}
type RemoveProductFromBasketResponse struct {
2022-12-20 16:07:56 +01:00
ProductID int `json:"product_id"`
BasketID string `json:"basket_id"`
2022-12-18 20:51:26 +01:00
}