Перевел на multi-tenant

Добавил поставщиков
Накладные успешно создаются из фронта
This commit is contained in:
2025-12-18 03:56:21 +03:00
parent 47ec8094e5
commit 542beafe0e
38 changed files with 1942 additions and 977 deletions

View File

@@ -11,10 +11,11 @@ import (
// Recipe - Технологическая карта
type Recipe struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
ProductID uuid.UUID `gorm:"type:uuid;not null;index"`
DateFrom time.Time `gorm:"index"`
DateTo *time.Time
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index"`
ProductID uuid.UUID `gorm:"type:uuid;not null;index"`
DateFrom time.Time `gorm:"index"`
DateTo *time.Time
Product catalog.Product `gorm:"foreignKey:ProductID"`
Items []RecipeItem `gorm:"foreignKey:RecipeID;constraint:OnDelete:CASCADE"`
@@ -22,11 +23,12 @@ type Recipe struct {
// RecipeItem - Ингредиент
type RecipeItem struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
RecipeID uuid.UUID `gorm:"type:uuid;not null;index"`
ProductID uuid.UUID `gorm:"type:uuid;not null;index"`
AmountIn decimal.Decimal `gorm:"type:numeric(19,4);not null"`
AmountOut decimal.Decimal `gorm:"type:numeric(19,4);not null"`
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index"`
RecipeID uuid.UUID `gorm:"type:uuid;not null;index"`
ProductID uuid.UUID `gorm:"type:uuid;not null;index"`
AmountIn decimal.Decimal `gorm:"type:numeric(19,4);not null"`
AmountOut decimal.Decimal `gorm:"type:numeric(19,4);not null"`
Product catalog.Product `gorm:"foreignKey:ProductID"`
}