43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// Product represents the product domain model
|
|
type Product struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// ProductCreateRequest represents the request for creating a product
|
|
type ProductCreateRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price" binding:"required,gt=0"`
|
|
}
|
|
|
|
// ProductUpdateRequest represents the request for updating a product
|
|
type ProductUpdateRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price" binding:"required,gt=0"`
|
|
}
|
|
|
|
// ProductResponse represents the response for product operations
|
|
type ProductResponse struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// ProductsResponse represents the response for listing products
|
|
type ProductsResponse struct {
|
|
Data []*Product `json:"data"`
|
|
}
|