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