From 6b608a86a93cb0877b51e536efbbb52a1863e930 Mon Sep 17 00:00:00 2001 From: Habib Fatkhul Rohman Date: Mon, 3 Nov 2025 11:42:46 +0700 Subject: [PATCH] feat(docs): Enhance API documentation for AssignMenusToRole and RemoveMenusFromRole endpoints --- modules/role/controller/role_controller.go | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/role/controller/role_controller.go b/modules/role/controller/role_controller.go index fcc2db1..b32690e 100644 --- a/modules/role/controller/role_controller.go +++ b/modules/role/controller/role_controller.go @@ -38,7 +38,17 @@ type ( } ) -// AssignMenusToRole implements RoleController. +// AssignMenusToRole godoc +// @Summary Assign menus to role +// @Description Assign menus to a role by role ID. +// @Tags Roles +// @Accept json +// @Produce json +// @Param id path string true "Role ID" +// @Param body body dto.AssignMenuRequest true "Assign menus payload" +// @Success 200 {object} map[string]interface{} +// @Failure 400 {object} map[string]interface{} +// @Router /roles/{id}/assign-menus [post] func (r *roleController) AssignMenusToRole(ctx *gin.Context) { id := ctx.Param("id") var req dto.AssignMenuRequest @@ -56,7 +66,17 @@ func (r *roleController) AssignMenusToRole(ctx *gin.Context) { ctx.JSON(http.StatusOK, res) } -// RemoveMenusFromRole implements RoleController. +// RemoveMenusFromRole godoc +// @Summary Remove menus from role +// @Description Remove menus from a role by role ID. +// @Tags Roles +// @Accept json +// @Produce json +// @Param id path string true "Role ID" +// @Param body body dto.RemoveMenuRequest true "Remove menus payload" +// @Success 200 {object} map[string]interface{} +// @Failure 400 {object} map[string]interface{} +// @Router /roles/{id}/remove-menus [post] func (r *roleController) RemoveMenusFromRole(ctx *gin.Context) { id := ctx.Param("id") var req dto.RemoveMenuRequest