Spaces:
Running
Running
Commit ·
bdfd28f
1
Parent(s): dc9bcf8
Deploy files from GitHub repository
Browse files
controllers/user_controller.go
CHANGED
|
@@ -34,20 +34,21 @@ func NewUserController(accountService services.AccountService) UserController {
|
|
| 34 |
// @Accept json
|
| 35 |
// @Produce json
|
| 36 |
// @Security BearerAuth
|
| 37 |
-
// @Param page query int false "Page number"
|
| 38 |
-
// @Param limit query int false "Number of items per page"
|
| 39 |
-
// @Param role query string false "Filter by role
|
| 40 |
// @Success 200 {object} dto.SuccessResponse[[]dto.UserResponse]
|
|
|
|
| 41 |
// @Failure 401 {object} dto.ErrorResponse
|
| 42 |
// @Failure 403 {object} dto.ErrorResponse
|
| 43 |
// @Router /api/v1/super-admin/users [get]
|
| 44 |
func (c *userController) ListUsers(ctx *gin.Context) {
|
| 45 |
limit, _ := strconv.Atoi(ctx.DefaultQuery("limit", "10"))
|
| 46 |
page, _ := strconv.Atoi(ctx.DefaultQuery("page", "1"))
|
| 47 |
-
role := ctx.DefaultQuery("role", "
|
| 48 |
|
| 49 |
if limit < 1 {
|
| 50 |
-
limit =
|
| 51 |
} else if limit > 50 {
|
| 52 |
limit = 50
|
| 53 |
}
|
|
|
|
| 34 |
// @Accept json
|
| 35 |
// @Produce json
|
| 36 |
// @Security BearerAuth
|
| 37 |
+
// @Param page query int false "Page number" default(1)
|
| 38 |
+
// @Param limit query int false "Number of items per page (max 50)" default(10)
|
| 39 |
+
// @Param role query string false "Filter by role: user, admin, super_admin"
|
| 40 |
// @Success 200 {object} dto.SuccessResponse[[]dto.UserResponse]
|
| 41 |
+
// @Failure 400 {object} dto.ErrorResponse
|
| 42 |
// @Failure 401 {object} dto.ErrorResponse
|
| 43 |
// @Failure 403 {object} dto.ErrorResponse
|
| 44 |
// @Router /api/v1/super-admin/users [get]
|
| 45 |
func (c *userController) ListUsers(ctx *gin.Context) {
|
| 46 |
limit, _ := strconv.Atoi(ctx.DefaultQuery("limit", "10"))
|
| 47 |
page, _ := strconv.Atoi(ctx.DefaultQuery("page", "1"))
|
| 48 |
+
role := ctx.DefaultQuery("role", "")
|
| 49 |
|
| 50 |
if limit < 1 {
|
| 51 |
+
limit = 10
|
| 52 |
} else if limit > 50 {
|
| 53 |
limit = 50
|
| 54 |
}
|