mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
Перевел на multi-tenant
Добавил поставщиков Накладные успешно создаются из фронта
This commit is contained in:
@@ -9,22 +9,25 @@ import (
|
||||
|
||||
// MeasureUnit - Единица измерения (kg, l, pcs)
|
||||
type MeasureUnit struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
|
||||
Name string `gorm:"type:varchar(50);not null" json:"name"`
|
||||
Code string `gorm:"type:varchar(50)" json:"code"`
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
|
||||
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index" json:"-"`
|
||||
Name string `gorm:"type:varchar(50);not null" json:"name"`
|
||||
Code string `gorm:"type:varchar(50)" json:"code"`
|
||||
}
|
||||
|
||||
// ProductContainer - Фасовка (упаковка) товара
|
||||
type ProductContainer struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
|
||||
ProductID uuid.UUID `gorm:"type:uuid;index;not null" json:"product_id"`
|
||||
Name string `gorm:"type:varchar(100);not null" json:"name"`
|
||||
Count decimal.Decimal `gorm:"type:numeric(19,4);not null" json:"count"` // Коэфф. пересчета
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
|
||||
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index" json:"-"`
|
||||
ProductID uuid.UUID `gorm:"type:uuid;index;not null" json:"product_id"`
|
||||
Name string `gorm:"type:varchar(100);not null" json:"name"`
|
||||
Count decimal.Decimal `gorm:"type:numeric(19,4);not null" json:"count"` // Коэфф. пересчета
|
||||
}
|
||||
|
||||
// Product - Номенклатура
|
||||
type Product struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
|
||||
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index" json:"-"`
|
||||
ParentID *uuid.UUID `gorm:"type:uuid;index" json:"parent_id"`
|
||||
Name string `gorm:"type:varchar(255);not null" json:"name"`
|
||||
Type string `gorm:"type:varchar(50);index" json:"type"` // GOODS, DISH, PREPARED
|
||||
@@ -53,11 +56,14 @@ type Product struct {
|
||||
type Repository interface {
|
||||
SaveMeasureUnits(units []MeasureUnit) error
|
||||
SaveProducts(products []Product) error
|
||||
SaveContainer(container ProductContainer) error // Добавление фасовки
|
||||
Search(query string) ([]Product, error)
|
||||
GetAll() ([]Product, error)
|
||||
GetActiveGoods() ([]Product, error)
|
||||
// --- Stores ---
|
||||
SaveContainer(container ProductContainer) error
|
||||
|
||||
Search(serverID uuid.UUID, query string) ([]Product, error)
|
||||
GetActiveGoods(serverID uuid.UUID) ([]Product, error)
|
||||
|
||||
SaveStores(stores []Store) error
|
||||
GetActiveStores() ([]Store, error)
|
||||
GetActiveStores(serverID uuid.UUID) ([]Store, error)
|
||||
|
||||
CountGoods(serverID uuid.UUID) (int64, error)
|
||||
CountStores(serverID uuid.UUID) (int64, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user