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,44 @@
package service
import (
"context"
"wucher/internal/domain/operation"
)
type HEMSOperationalDataService struct {
repo operation.HEMSOperationalDataRepository
}
func NewHEMSOperationalDataService(repo operation.HEMSOperationalDataRepository) *HEMSOperationalDataService {
return &HEMSOperationalDataService{repo: repo}
}
func (s *HEMSOperationalDataService) Create(ctx context.Context, row *operation.HEMSOperationalData) error {
return s.repo.Create(ctx, row)
}
func (s *HEMSOperationalDataService) Update(ctx context.Context, row *operation.HEMSOperationalData) error {
return s.repo.Update(ctx, row)
}
func (s *HEMSOperationalDataService) Delete(ctx context.Context, id []byte, deletedBy []byte) error {
return s.repo.Delete(ctx, id, deletedBy)
}
func (s *HEMSOperationalDataService) GetByID(ctx context.Context, id []byte) (*operation.HEMSOperationalData, error) {
return s.repo.GetByID(ctx, id)
}
func (s *HEMSOperationalDataService) List(ctx context.Context, filter, sort string, limit, offset int) ([]operation.HEMSOperationalData, int64, error) {
return s.repo.List(ctx, filter, normalizeHEMSOperationalDataSort(sort), limit, offset)
}
func normalizeHEMSOperationalDataSort(sort string) string {
return normalizeSortByRules(sort,
sortField("time"),
sortField("location"),
sortField("created_at"),
sortField("updated_at"),
)
}