Перевел на 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

@@ -0,0 +1,29 @@
package suppliers
import (
"time"
"github.com/google/uuid"
)
// Supplier - Поставщик (Контрагент)
type Supplier struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`
Name string `gorm:"type:varchar(255);not null" json:"name"`
Code string `gorm:"type:varchar(50)" json:"code"`
INN string `gorm:"type:varchar(20)" json:"inn"` // taxpayerIdNumber
// Привязка к конкретному серверу iiko (Multi-tenant)
RMSServerID uuid.UUID `gorm:"type:uuid;not null;index" json:"-"`
IsDeleted bool `gorm:"default:false" json:"is_deleted"`
UpdatedAt time.Time `json:"updated_at"`
}
type Repository interface {
SaveBatch(suppliers []Supplier) error
// GetRankedByUsage возвращает поставщиков, отсортированных по частоте использования в накладных за N дней
GetRankedByUsage(serverID uuid.UUID, daysLookBack int) ([]Supplier, error)
Count(serverID uuid.UUID) (int64, error)
}