[hw-1] implement cart service

This commit is contained in:
Никита Шубин
2025-05-25 15:49:17 +00:00
parent 3d3f10647b
commit 5077f04b0c
28 changed files with 1151 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
package model
import (
"fmt"
"route256/cart/internal/domain/entity"
)
type Product struct {
Name string
Price int32
Sku entity.Sku `validate:"gt=0"`
}
func (p *Product) Validate() error {
if err := validate.Struct(p); err != nil {
return fmt.Errorf("invalid requested values: %w", err)
}
return nil
}