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 {
|
|
|
|
ID int `db:"id"`
|
|
|
|
PID string `db:"pid"`
|
|
|
|
Name string `db:"name"`
|
|
|
|
Price float64 `db:"price"`
|
|
|
|
CreatedAt time.Duration `db:"created_at"`
|
|
|
|
UpdatedAt time.Duration `db:"updated_at,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetProductListRequest struct {
|
|
|
|
CategoryID int `json:"category_id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetProductListResponse struct {
|
|
|
|
Products []GetProductResponse
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|