Files
fm_be/internal/service/insurance_patient_data_service.go
2026-07-16 22:16:45 +07:00

43 lines
1.4 KiB
Go

package service
import (
"context"
insurancepatientdata "wucher/internal/domain/insurance_patient_data"
)
type InsurancePatientDataService struct {
repo insurancepatientdata.Repository
}
func NewInsurancePatientDataService(repo insurancepatientdata.Repository) *InsurancePatientDataService {
return &InsurancePatientDataService{repo: repo}
}
func (s *InsurancePatientDataService) Create(ctx context.Context, row *insurancepatientdata.InsurancePatientData) error {
return s.repo.Create(ctx, row)
}
func (s *InsurancePatientDataService) Update(ctx context.Context, row *insurancepatientdata.InsurancePatientData) error {
return s.repo.Update(ctx, row)
}
func (s *InsurancePatientDataService) Delete(ctx context.Context, id []byte, deletedBy []byte) error {
return s.repo.Delete(ctx, id, deletedBy)
}
func (s *InsurancePatientDataService) GetByID(ctx context.Context, id []byte) (*insurancepatientdata.InsurancePatientData, error) {
return s.repo.GetByID(ctx, id)
}
func (s *InsurancePatientDataService) List(ctx context.Context, filter, sort string, limit, offset int) ([]insurancepatientdata.InsurancePatientData, int64, error) {
return s.repo.List(ctx, filter, normalizeInsurancePatientDataSort(sort), limit, offset)
}
func normalizeInsurancePatientDataSort(sort string) string {
return normalizeSortByRules(sort,
sortField("created_at"),
sortField("updated_at"),
)
}