initiate reference pasien
This commit is contained in:
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package pasien
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
baseResponse "antrian-operasi/internal/shared"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PasienHandler struct {
|
||||
repo IPasienRepository
|
||||
}
|
||||
|
||||
func NewPasienHandler(repo IPasienRepository) PasienHandler {
|
||||
return PasienHandler{repo}
|
||||
}
|
||||
|
||||
// ListPasien godoc
|
||||
// @Summary Get List Pasien
|
||||
// @Tags Pasien
|
||||
// @Param search query string false "Search keyword"
|
||||
// @Success 200 {object} []PasienModel
|
||||
// @Failure 500 {object} shared.BaseErrorResponse
|
||||
// @Router /reference/pasien/ [get]
|
||||
func (h PasienHandler) ListPasienOperasi(c *gin.Context) {
|
||||
list, err := h.repo.SearchableListPasien(c)
|
||||
if err != nil {
|
||||
errorResponse := baseResponse.BaseErrorResponse{
|
||||
Success: false,
|
||||
Code: 500,
|
||||
Message: err.Error(),
|
||||
}
|
||||
c.JSON(http.StatusInternalServerError, errorResponse)
|
||||
return
|
||||
}
|
||||
|
||||
response := baseResponse.ToBaseResponse(list, true, 200, "success get pasien")
|
||||
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
Reference in New Issue
Block a user