Skip to content

Commit

Permalink
Update Response
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmmdriz committed Jun 24, 2024
1 parent 451b23e commit 2609e25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion controllers/regency/regency.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package regency

import (
"e-complaint-api/controllers/base"
"e-complaint-api/controllers/regency/response"
"e-complaint-api/entities"
"net/http"

Expand All @@ -22,5 +23,10 @@ func (rc *RegencyController) GetAll(c echo.Context) error {
return c.JSON(http.StatusInternalServerError, err.Error())
}

return c.JSON(http.StatusOK, base.NewSuccessResponse("Success get all regencies", regencies))
var responseRegencies []*response.Regency
for _, regency := range regencies {
responseRegencies = append(responseRegencies, response.FromEntitiesToResponse(&regency))
}

return c.JSON(http.StatusOK, base.NewSuccessResponse("Success get all regencies", responseRegencies))
}

0 comments on commit 2609e25

Please sign in to comment.