39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package request
|
|
|
|
import (
|
|
"server/internal/model/common"
|
|
"server/internal/pkg/validator"
|
|
)
|
|
|
|
type CreateUserRequest struct {
|
|
Username string `json:"username" validate:"required,min=1,max=50"`
|
|
Account string `json:"account" validate:"required,min=5,max=100"`
|
|
Password string `json:"password" validate:"required,min=6,max=255"`
|
|
AvatarID *int32 `json:"avatar_id" validate:"omitempty"`
|
|
Status *int16 `json:"status" validate:"oneof=0 1"`
|
|
}
|
|
|
|
type UpdateUserRequest struct {
|
|
Username *string `json:"username" validate:"omitempty,min=1,max=50"`
|
|
AvatarID validator.NullInt32 `json:"avatar_id" validate:"omitempty"`
|
|
Status *int16 `json:"status" validate:"omitempty,oneof=0 1"`
|
|
}
|
|
|
|
type UpdateUserPassword struct {
|
|
Password string `json:"password" validate:"required,min=6,max=255"`
|
|
}
|
|
|
|
type SetUserRolesRequest struct {
|
|
RoleIDs []int32 `json:"role_ids" validate:"required,dive,gt=0"`
|
|
}
|
|
|
|
type LoginRequest struct {
|
|
Account string `json:"account" validate:"required,min=5,max=100"`
|
|
Password string `json:"password" validate:"required,min=6,max=255"`
|
|
}
|
|
|
|
type SearchUserParams struct {
|
|
common.Pagination
|
|
Username string `json:"username" validate:"omitempty,max=50"`
|
|
}
|