fixing reference query get by id

This commit is contained in:
renaldybrada
2026-01-29 10:19:13 +07:00
parent 10f0437333
commit 1e15a2e1ec
5 changed files with 240 additions and 53 deletions
@@ -1,6 +1,7 @@
package dokter
import (
"log"
"net/http"
baseResponse "antrian-operasi/internal/shared"
@@ -32,3 +33,25 @@ func (h DokterHandler) ListDokter(c *gin.Context) {
c.JSON(http.StatusOK, response)
}
// Test repository GetDokterById, soon to be deleted
func (h DokterHandler) GetDokterById(c *gin.Context) {
var result DokterModel
idDokter := c.Param("id")
result, err := h.repo.GetDokterById(c, idDokter)
if err != nil {
log.Printf("something went wrong : %s", err)
c.JSON(http.StatusInternalServerError, err)
return
}
response := baseResponse.ToBaseResponse(
result.ToResponse(),
true,
200,
"success get doctor's list")
c.JSON(http.StatusOK, response)
}