Files
api-antrian-operasi/internal/domain/dashboard/handler.go
T
2026-02-03 13:45:43 +07:00

41 lines
971 B
Go

package dashboard
import (
"net/http"
baseResponse "antrian-operasi/internal/shared"
"github.com/gin-gonic/gin"
)
type DashboardHandler struct {
repo IDashboardRepository
}
func NewDashboardHandler(repo IDashboardRepository) DashboardHandler {
return DashboardHandler{repo}
}
// GetAntrianPerKategori godoc
// @Summary Get Antrian Per Kategori
// @Tags Dashboard
// @Success 200 {object} []AntrianPerKategori
// @Failure 500 {object} shared.BaseErrorResponse
// @Router /dashboard/antrian-per-kategori/ [get]
func (h DashboardHandler) GetAntrianPerKategori(c *gin.Context) {
data, err := h.repo.GetAntrianPerKategori(c)
if err != nil {
errorResponse := baseResponse.BaseErrorResponse{
Success: false,
Code: 500,
Message: err.Error(),
}
c.JSON(http.StatusInternalServerError, errorResponse)
return
}
response := baseResponse.ToBaseResponse(data, true, 200, "success get jumlah antrian per kategori")
c.JSON(http.StatusOK, response)
}