Files
rmser/internal/domain/suppliers/entity.go
SERTY 310a64e3ba редактирование и удаление сопоставлений
список накладных с позициями
2025-12-29 10:46:05 +03:00

31 lines
1.0 KiB
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
GetByID(id uuid.UUID) (*Supplier, error)
// GetRankedByUsage возвращает поставщиков, отсортированных по частоте использования в накладных за N дней
GetRankedByUsage(serverID uuid.UUID, daysLookBack int) ([]Supplier, error)
Count(serverID uuid.UUID) (int64, error)
}