init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
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"),
)
}