feat: add search and pagination to tariff period services

This commit is contained in:
2026-09-02 09:27:23 +07:00
parent 1d5bc309c0
commit 181d53af45
8 changed files with 560 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
package http
import (
"net/http"
"primaya-api/cpone-middleware/internal/repository"
)
func (h Handler) ListPeriodeTarif(w http.ResponseWriter, r *http.Request) {
items, err := h.periodeTarifRepository(r.Context()).ListPeriodeTarif(r.Context())
if err != nil {
WriteJSON(w, http.StatusInternalServerError, Response{
Success: false,
Message: "internal server error",
Data: nil,
})
return
}
if items == nil {
items = []repository.PeriodeTarif{}
}
WriteJSON(w, http.StatusOK, Response{
Success: true,
Message: "ok",
Data: items,
})
}