start rmser

This commit is contained in:
2025-11-29 08:40:24 +03:00
commit 5aa2238eea
2117 changed files with 375169 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package catalog
import (
"time"
"github.com/google/uuid"
"github.com/shopspring/decimal"
)
// Product - Номенклатура
type Product struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
ParentID *uuid.UUID `gorm:"type:uuid;index"`
Name string `gorm:"type:varchar(255);not null"`
Type string `gorm:"type:varchar(50);index"` // GOODS, DISH, PREPARED, etc.
Num string `gorm:"type:varchar(50)"`
Code string `gorm:"type:varchar(50)"`
UnitWeight decimal.Decimal `gorm:"type:numeric(19,4)"`
UnitCapacity decimal.Decimal `gorm:"type:numeric(19,4)"`
IsDeleted bool `gorm:"default:false"`
Parent *Product `gorm:"foreignKey:ParentID"`
Children []*Product `gorm:"foreignKey:ParentID"`
CreatedAt time.Time
UpdatedAt time.Time
}
// Repository интерфейс для каталога
type Repository interface {
SaveProducts(products []Product) error
GetAll() ([]Product, error)
GetActiveGoods() ([]Product, error)
}