mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
Перевел на multi-tenant
Добавил поставщиков Накладные успешно создаются из фронта
This commit is contained in:
29
internal/domain/suppliers/entity.go
Normal file
29
internal/domain/suppliers/entity.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user