Skip to content

Commit

Permalink
fix: FindAll pet handler
Browse files Browse the repository at this point in the history
  • Loading branch information
macgeargear committed Dec 30, 2023
1 parent fd3797d commit 49dfd38
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/app/handler/pet/pet.handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@ func NewHandler(service Service, imageService ImageService, validate *validator.
}

func (h *Handler) FindAll(c router.IContext) {
request := &dto.FindOnePetDto{}
err := c.Bind(request)
if err != nil {
c.JSON(http.StatusBadRequest, dto.ResponseErr{
StatusCode: http.StatusBadRequest,
Message: constant.BindingRequestErrorMessage + err.Error(),
Data: nil,
})
response, respErr := h.service.FindAll()
if respErr != nil {
c.JSON(respErr.StatusCode, respErr)
return
}

c.JSON(http.StatusOK, nil)
c.JSON(http.StatusOK, response)
}

func (h *Handler) FindOne(c router.IContext) {
Expand Down

0 comments on commit 49dfd38

Please sign in to comment.