fix drone
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3eb95574fe
commit
eeb167af3b
|
|
@ -1,13 +1,14 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
"github.com/rs/zerolog"
|
||||
"web-qudo-be/app/module/clients/request"
|
||||
"web-qudo-be/app/module/clients/service"
|
||||
"web-qudo-be/utils/paginator"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
utilRes "web-qudo-be/utils/response"
|
||||
utilVal "web-qudo-be/utils/validator"
|
||||
)
|
||||
|
|
@ -45,8 +46,12 @@ func NewClientsController(clientsService service.ClientsService, log zerolog.Log
|
|||
// @Failure 500 {object} response.InternalServerError
|
||||
// @Router /clients [get]
|
||||
func (_i *clientsController) All(c *fiber.Ctx) error {
|
||||
|
||||
_i.Log.Info().Msg("GET /clients endpoint hit")
|
||||
|
||||
paginate, err := paginator.Paginate(c)
|
||||
if err != nil {
|
||||
_i.Log.Error().Err(err).Msg("Pagination error")
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -54,14 +59,27 @@ func (_i *clientsController) All(c *fiber.Ctx) error {
|
|||
Name: c.Query("name"),
|
||||
CreatedById: c.Query("createdById"),
|
||||
}
|
||||
|
||||
_i.Log.Info().
|
||||
Str("name", reqContext.Name).
|
||||
Str("createdById", reqContext.CreatedById).
|
||||
Msg("Query params received")
|
||||
|
||||
req := reqContext.ToParamRequest()
|
||||
req.Pagination = paginate
|
||||
|
||||
_i.Log.Info().Interface("request", req).Msg("Request after conversion")
|
||||
|
||||
clientsData, paging, err := _i.clientsService.All(req)
|
||||
if err != nil {
|
||||
_i.Log.Error().Err(err).Msg("Service error while getting clients")
|
||||
return err
|
||||
}
|
||||
|
||||
_i.Log.Info().
|
||||
Int("data_count", len(clientsData)).
|
||||
Msg("Clients successfully retrieved")
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"Clients list successfully retrieved"},
|
||||
|
|
|
|||
Loading…
Reference in New Issue