Files
rmser/internal/domain/ocr/entity.go
2025-11-29 08:40:24 +03:00

32 lines
943 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package ocr
import (
"time"
"github.com/google/uuid"
"rmser/internal/domain/catalog"
)
// ProductMatch связывает текст из чека с конкретным товаром в iiko
type ProductMatch struct {
// RawName - распознанный текст (ключ).
// Лучше хранить в нижнем регистре и без лишних пробелов.
RawName string `gorm:"type:varchar(255);primary_key"`
ProductID uuid.UUID `gorm:"type:uuid;not null;index"`
// Product - связь для GORM
Product catalog.Product `gorm:"foreignKey:ProductID"`
UpdatedAt time.Time
CreatedAt time.Time
}
type Repository interface {
// SaveMatch сохраняет или обновляет привязку
SaveMatch(rawName string, productID uuid.UUID) error
// FindMatch ищет товар по точному совпадению названия
FindMatch(rawName string) (*uuid.UUID, error)
}