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:
@@ -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{
|
||||
@@ -276,12 +279,12 @@ func (u *userService) SearchUser(ctx context.Context, dto *request.SearchUserDto
|
||||
|
||||
g.Go(func() error {
|
||||
countArg := sqlc.CountUsersParams{
|
||||
RoleIds: arg.RoleIds,
|
||||
AuthProvider: arg.AuthProvider,
|
||||
CreatedFrom: arg.CreatedFrom,
|
||||
RoleIds: arg.RoleIds,
|
||||
AuthProvider: arg.AuthProvider,
|
||||
CreatedFrom: arg.CreatedFrom,
|
||||
CreatedTo: arg.CreatedTo,
|
||||
IsDeleted: arg.IsDeleted,
|
||||
SearchText: arg.SearchText,
|
||||
SearchText: arg.SearchText,
|
||||
}
|
||||
var err error
|
||||
totalRecords, err = u.userRepo.Count(gCtx, countArg)
|
||||
|
||||
Reference in New Issue
Block a user