mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
[hw-1] implement cart service
This commit is contained in:
16
cart/internal/domain/model/items.go
Normal file
16
cart/internal/domain/model/items.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Item struct {
|
||||
Product *Product
|
||||
Count uint32 `validate:"gt=0"`
|
||||
}
|
||||
|
||||
func (i *Item) Validate() error {
|
||||
if err := validate.Struct(i); err != nil {
|
||||
return fmt.Errorf("invalid requested values: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user