35 lines
606 B
Go
35 lines
606 B
Go
package dokter
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
baseResponse "antrian-operasi/internal/shared"
|
|
|
|
"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)
|
|
}
|
|
|
|
response := baseResponse.ToBaseResponse(
|
|
list.ToResponseList(),
|
|
true,
|
|
200,
|
|
"success get doctor's list")
|
|
|
|
c.JSON(http.StatusOK, response)
|
|
}
|