From eef2822c2be26e0a63577e76eedcc98edf1c953d Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Wed, 15 May 2024 13:52:42 +0700 Subject: [PATCH] feat: fixing ppid data categories --- .../controller/ppid_data_categories.controller.go | 8 ++++++++ .../request/ppid_data_categories.request.go | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go b/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go index 380ac68..80635a1 100644 --- a/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go +++ b/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go @@ -2,10 +2,12 @@ package controller import ( "github.com/gofiber/fiber/v2" + "github.com/rs/zerolog" "go-humas-be/app/module/ppid_data_categories/request" "go-humas-be/app/module/ppid_data_categories/service" "go-humas-be/utils/paginator" "strconv" + "time" utilRes "go-humas-be/utils/response" utilVal "go-humas-be/utils/validator" @@ -13,6 +15,7 @@ import ( type ppidDataCategoriesController struct { ppidDataCategoriesService service.PpidDataCategoriesService + Log zerolog.Logger } type PpidDataCategoriesController interface { @@ -57,6 +60,11 @@ func (_i *ppidDataCategoriesController) All(c *fiber.Ctx) error { IsOnlyTop: c.Query("isOnlyTop"), } req := reqContext.ToParamRequest() + + _i.Log.Info().Str("timestamp", time.Now(). + Format(time.RFC3339)).Str("Service:All", "ppidDataCategoriesController"). + Interface("req", req).Msg("") + req.Pagination = paginate ppidDataCategoriesData, paging, err := _i.ppidDataCategoriesService.All(req) diff --git a/app/module/ppid_data_categories/request/ppid_data_categories.request.go b/app/module/ppid_data_categories/request/ppid_data_categories.request.go index 82dac19..8c2dee3 100644 --- a/app/module/ppid_data_categories/request/ppid_data_categories.request.go +++ b/app/module/ppid_data_categories/request/ppid_data_categories.request.go @@ -72,8 +72,9 @@ func (req PpidDataCategoriesQueryRequestContext) ToParamRequest() PpidDataCatego } if parentIdStr := req.ParentId; parentIdStr != "" { parentId, err := strconv.ParseUint(parentIdStr, 10, 0) + parentIdUint := uint(parentId) if err == nil { - *request.ParentId = uint(parentId) + request.ParentId = &parentIdUint } } if isOnlyTopStr := req.IsOnlyTop; isOnlyTopStr != "" {