mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
30 lines
1015 B
Go
30 lines
1015 B
Go
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)
|
|
}
|