package tindakan import ( "net/http" baseResponse "antrian-operasi/internal/shared" "github.com/gin-gonic/gin" ) type TindakanHandler struct { repo ITindakanRepository } func NewTindakanHandler(repo ITindakanRepository) TindakanHandler { return TindakanHandler{repo} } // List Tindakan godoc // @Summary Get List Tindakan // @Tags Reference // @Param search query string false "Search keyword" // @Success 200 {object} []TindakanResponse // @Failure 500 {object} shared.BaseErrorResponse // @Router /reference/tindakan/ [get] func (h TindakanHandler) ListDiagnosa(c *gin.Context) { search := c.Query("search") list, err := h.repo.SearchableListTindakan(c, search) if err != nil { errorResponse := baseResponse.BaseErrorResponse{ Success: false, Code: 500, Message: err.Error(), } c.JSON(http.StatusInternalServerError, errorResponse) return } response := baseResponse.ToBaseResponse(list.ToResponseList(), true, 200, "success get diagnosa") c.JSON(http.StatusOK, response) }