UPDATE: Some logic change
All checks were successful
Build and Release / release (push) Successful in 1m1s
All checks were successful
Build and Release / release (push) Successful in 1m1s
This commit is contained in:
@@ -868,6 +868,12 @@ const docTemplate = `{
|
||||
"summary": "Search users",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
"local",
|
||||
"google",
|
||||
"facebook",
|
||||
"github"
|
||||
],
|
||||
"type": "string",
|
||||
"name": "auth_provider",
|
||||
"in": "query"
|
||||
@@ -892,8 +898,7 @@ const docTemplate = `{
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
|
||||
@@ -861,6 +861,12 @@
|
||||
"summary": "Search users",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
"local",
|
||||
"google",
|
||||
"facebook",
|
||||
"github"
|
||||
],
|
||||
"type": "string",
|
||||
"name": "auth_provider",
|
||||
"in": "query"
|
||||
@@ -885,8 +891,7 @@
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
|
||||
@@ -737,7 +737,12 @@ paths:
|
||||
- application/json
|
||||
description: Search and filter users with pagination (Admin/Mod only)
|
||||
parameters:
|
||||
- in: query
|
||||
- enum:
|
||||
- local
|
||||
- google
|
||||
- facebook
|
||||
- github
|
||||
in: query
|
||||
name: auth_provider
|
||||
type: string
|
||||
- in: query
|
||||
@@ -753,7 +758,6 @@ paths:
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
name: limit
|
||||
required: true
|
||||
type: integer
|
||||
- enum:
|
||||
- asc
|
||||
|
||||
@@ -25,7 +25,7 @@ type ChangeRoleDto struct {
|
||||
|
||||
type PaginationDto struct {
|
||||
Page int `json:"page" query:"page" validate:"omitempty,min=1"`
|
||||
Limit int `json:"limit" query:"limit" validate:"required,min=1,max=100"`
|
||||
Limit int `json:"limit" query:"limit" validate:"omitempty,min=1,max=100"`
|
||||
Order string `json:"order" query:"order" validate:"omitempty,oneof=asc desc"`
|
||||
}
|
||||
type SearchUserDto struct {
|
||||
@@ -34,7 +34,7 @@ type SearchUserDto struct {
|
||||
Search string `json:"search" query:"search" validate:"omitempty,min=2,max=200"`
|
||||
IsDeleted *bool `json:"is_deleted" query:"is_deleted" validate:"omitempty"`
|
||||
RoleIDs []string `json:"role_ids" query:"role_ids" validate:"omitempty,dive,uuid"`
|
||||
AuthProvider string `json:"auth_provider" query:"auth_provider" validate:"omitempty"`
|
||||
AuthProvider string `json:"auth_provider" query:"auth_provider" validate:"omitempty,oneof=local google facebook github"`
|
||||
CreatedFrom *time.Time `json:"created_from" query:"created_from" validate:"omitempty"`
|
||||
CreatedTo *time.Time `json:"created_to" query:"created_to" validate:"omitempty"`
|
||||
}
|
||||
|
||||
@@ -153,6 +153,9 @@ func (m *mediaService) SearchMedia(ctx context.Context, dto *request.SearchMedia
|
||||
if dto.Page < 1 {
|
||||
dto.Page = 1
|
||||
}
|
||||
if dto.Limit == 0 {
|
||||
dto.Limit = 20
|
||||
}
|
||||
offset := (dto.Page - 1) * dto.Limit
|
||||
|
||||
arg := sqlc.SearchMediasParams{
|
||||
|
||||
@@ -254,6 +254,9 @@ func (u *userService) SearchUser(ctx context.Context, dto *request.SearchUserDto
|
||||
if dto.Page < 1 {
|
||||
dto.Page = 1
|
||||
}
|
||||
if dto.Limit == 0 {
|
||||
dto.Limit = 20
|
||||
}
|
||||
offset := (dto.Page - 1) * dto.Limit
|
||||
|
||||
arg := sqlc.SearchUsersParams{
|
||||
|
||||
Reference in New Issue
Block a user