Files
cpone_midleware/internal/http/periode_tarif.go

30 lines
573 B
Go

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,
})
}