package service import ( "context" "wucher/internal/domain/operation" ) type HEMSOperationService struct { repo operation.HEMSOperationRepository } func NewHEMSOperationService(repo operation.HEMSOperationRepository) *HEMSOperationService { return &HEMSOperationService{repo: repo} } func (s *HEMSOperationService) Create(ctx context.Context, row *operation.HEMSOperation) error { return s.repo.Create(ctx, row) } func (s *HEMSOperationService) Update(ctx context.Context, row *operation.HEMSOperation) error { return s.repo.Update(ctx, row) } func (s *HEMSOperationService) Delete(ctx context.Context, id []byte, deletedBy []byte) error { return s.repo.Delete(ctx, id, deletedBy) } func (s *HEMSOperationService) GetByID(ctx context.Context, id []byte) (*operation.HEMSOperation, error) { return s.repo.GetByID(ctx, id) } func (s *HEMSOperationService) List(ctx context.Context, filter string, sort string, limit, offset int) ([]operation.HEMSOperation, int64, error) { return s.repo.List(ctx, filter, normalizeHEMSOperationSort(sort), limit, offset) } func normalizeHEMSOperationSort(sort string) string { return normalizeSortByRules(sort, sortField("date"), sortField("created_at"), sortField("updated_at"), ) }