From 05073896cc22e01181419d85e98bde78463fbfed Mon Sep 17 00:00:00 2001 From: Aldino Kemal Date: Sat, 19 Apr 2025 19:08:57 +0700 Subject: [PATCH] feat: Add validation for empty Group ID in participant request listing - Implemented a check to ensure Group ID is not empty in the ListParticipantRequests method. - Returns a 400 Bad Request response with an appropriate error message if Group ID is missing. --- src/internal/rest/group.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/internal/rest/group.go b/src/internal/rest/group.go index 321d2a8..b365862 100644 --- a/src/internal/rest/group.go +++ b/src/internal/rest/group.go @@ -102,6 +102,14 @@ func (controller *Group) ListParticipantRequests(c *fiber.Ctx) error { err := c.QueryParser(&request) utils.PanicIfNeeded(err) + if request.GroupID == "" { + return c.Status(fiber.StatusBadRequest).JSON(utils.ResponseData{ + Status: 400, + Code: "INVALID_GROUP_ID", + Message: "Group ID cannot be empty", + }) + } + whatsapp.SanitizePhone(&request.GroupID) result, err := controller.Service.GetGroupRequestParticipants(c.UserContext(), request)