40 lines
888 B
Go
40 lines
888 B
Go
package spesialis
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
baseResponse "antrian-operasi/internal/shared"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type SpesialisHandler struct {
|
|
repo ISpesialisRepository
|
|
}
|
|
|
|
func NewSpesialisHandler(repo ISpesialisRepository) SpesialisHandler {
|
|
return SpesialisHandler{repo}
|
|
}
|
|
|
|
func (h SpesialisHandler) ListSpesialis(c *gin.Context) {
|
|
list, err := h.repo.SearchableListSpesialis(c)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, err)
|
|
}
|
|
|
|
response := baseResponse.ToBaseResponse(list, true, 200, "success get list spesialis")
|
|
|
|
c.JSON(http.StatusOK, response)
|
|
}
|
|
|
|
func (h SpesialisHandler) ListSubSpesialis(c *gin.Context) {
|
|
list, err := h.repo.SearchableListSubSpesialis(c)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, err)
|
|
}
|
|
|
|
response := baseResponse.ToBaseResponse(list, true, 200, "success get list spesialis")
|
|
|
|
c.JSON(http.StatusOK, response)
|
|
}
|