fixing reference query get by id
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user