feat(cpone): migrate lab registration endpoints

This commit is contained in:
2026-08-18 14:14:49 +07:00
parent 676d930561
commit a799022bb5
11 changed files with 2590 additions and 7 deletions

View File

@@ -16,12 +16,23 @@ type LayananRepository interface {
MappingHarga(ctx context.Context, params repository.MappingHargaParams) ([]repository.TarifLayanan, error)
}
type Handler struct {
repo LayananRepository
type LabRegistrationRepository interface {
RegisterLab(ctx context.Context, params repository.LabRegistrationParams) (repository.LabRegistrationOutcome, error)
AddLabServices(ctx context.Context, regID string, params repository.AddLabServicesParams) (repository.LabRegistrationOutcome, error)
}
func NewHandler(repo LayananRepository) Handler {
return Handler{repo: repo}
type Handler struct {
layananRepo LayananRepository
labRepo LabRegistrationRepository
}
type CPONERepository interface {
LayananRepository
LabRegistrationRepository
}
func NewHandler(repo CPONERepository) Handler {
return Handler{layananRepo: repo, labRepo: repo}
}
func (h Handler) MappingHarga(w http.ResponseWriter, r *http.Request) {
@@ -55,7 +66,7 @@ func (h Handler) MappingHarga(w http.ResponseWriter, r *http.Request) {
return
}
rows, err := h.repo.MappingHarga(r.Context(), repository.MappingHargaParams{
rows, err := h.layananRepo.MappingHarga(r.Context(), repository.MappingHargaParams{
PeriodeTarifID: periodeTarifID,
LayananIDs: layananIDs,
Search: strings.TrimSpace(r.URL.Query().Get("search")),