26 lines
590 B
Go
26 lines
590 B
Go
package http
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"primaya-api/cpone-middleware/internal/repository"
|
|
)
|
|
|
|
type Response struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
Data any `json:"data"`
|
|
}
|
|
|
|
type MappingHargaData struct {
|
|
PeriodeTarifID string `json:"PeriodeTarifID"`
|
|
DetailLayanan []repository.TarifLayanan `json:"DetailLayanan"`
|
|
}
|
|
|
|
func WriteJSON(w http.ResponseWriter, statusCode int, payload Response) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(statusCode)
|
|
_ = json.NewEncoder(w).Encode(payload)
|
|
}
|