27 lines
456 B
Go
27 lines
456 B
Go
package dokter
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type DokterHandler struct {
|
|
repo IDokterRepository
|
|
}
|
|
|
|
func NewDokterHandler(repo IDokterRepository) DokterHandler {
|
|
return DokterHandler{repo}
|
|
}
|
|
|
|
func (h DokterHandler) ListDokter(c *gin.Context) {
|
|
var list ListDokterModel
|
|
|
|
list, err := h.repo.SearchableListDokter(c)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, err)
|
|
}
|
|
|
|
c.JSON(http.StatusOK, list.ToResponseList())
|
|
}
|