user

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptchaReply

type CaptchaReply struct {
	Uuid    string `json:"uuid"`
	Captcha string `json:"captcha"`
	Expire  uint32 `json:"expire"`
}

type ChangeUserPasswordRequest

type ChangeUserPasswordRequest struct {
	Password  string `json:"password"`
	CaptchaId string `json:"captcha_id"`
	Captcha   string `json:"captcha"`
}

type PageUserRequest

type PageUserRequest struct {
	Page          uint32   `json:"page"`
	PageSize      uint32   `json:"page_size"`
	DepartmentIds []uint32 `json:"department_ids"`
	Username      *string  `json:"username"`
	Status        *bool    `json:"status"`
	RoleId        *uint32  `json:"role_id"`
	DepartmentId  *uint32  `json:"department_id"`
	StartTime     *uint32  `json:"start_time"`
	EndTime       *uint32  `json:"end_time"`
	Name          *string  `json:"name"`
}

type Repo

type Repo interface {
	GetUser(ctx kratosx.Context, id uint32) (*User, error)
	GetUserByPhone(ctx kratosx.Context, phone string) (*User, error)
	GetUserByEmail(ctx kratosx.Context, email string) (*User, error)
	PageUser(ctx kratosx.Context, in *PageUserRequest) ([]*User, uint32, error)
	HasRole(ctx kratosx.Context, uid, rid uint32) bool
	AddUser(ctx kratosx.Context, in *User) (uint32, error)
	UpdateUser(ctx kratosx.Context, in *User) error
	DeleteUser(ctx kratosx.Context, id uint32) error
}

type UpdateCurrentUserRequest

type UpdateCurrentUserRequest struct {
	Nickname string `json:"nickname"`
	Gender   string `json:"gender"`
}

type UseCase

type UseCase struct {
	// contains filtered or unexported fields
}

func NewUseCase

func NewUseCase(conf *config.Config, repo Repo, depRepo department.Repo, roleRepo role.Repo) *UseCase

func (*UseCase) AddUser

func (u *UseCase) AddUser(ctx kratosx.Context, user *User) (uint32, error)

func (*UseCase) ChangePasswordCaptcha

func (u *UseCase) ChangePasswordCaptcha(ctx kratosx.Context) (*CaptchaReply, error)

func (*UseCase) ChangeUserPassword

func (u *UseCase) ChangeUserPassword(ctx kratosx.Context, in *ChangeUserPasswordRequest) error

func (*UseCase) CurrentUser

func (u *UseCase) CurrentUser(ctx kratosx.Context) (*User, error)

CurrentUser 查询当前用户信息

func (*UseCase) DeleteUser

func (u *UseCase) DeleteUser(ctx kratosx.Context, id uint32) error

func (*UseCase) DisableUser

func (u *UseCase) DisableUser(ctx kratosx.Context, id uint32, desc string) error

func (*UseCase) EnableUser

func (u *UseCase) EnableUser(ctx kratosx.Context, id uint32) error

func (*UseCase) OfflineUser

func (u *UseCase) OfflineUser(ctx kratosx.Context, id uint32) error

func (*UseCase) PageUser

func (u *UseCase) PageUser(ctx kratosx.Context, in *PageUserRequest) ([]*User, uint32, error)

func (*UseCase) ResetUserPassword

func (u *UseCase) ResetUserPassword(ctx kratosx.Context, id uint32) error

func (*UseCase) SwitchCurrentUserRole

func (u *UseCase) SwitchCurrentUserRole(ctx kratosx.Context, id uint32) error

func (*UseCase) UpdateCurrentUser

func (u *UseCase) UpdateCurrentUser(ctx kratosx.Context, in *UpdateCurrentUserRequest) error

func (*UseCase) UpdateUser

func (u *UseCase) UpdateUser(ctx kratosx.Context, user *User) error

func (*UseCase) UserLogin

func (u *UseCase) UserLogin(ctx kratosx.Context, in *UserLoginRequest) (string, error)

func (*UseCase) UserLoginCaptcha

func (u *UseCase) UserLoginCaptcha(ctx kratosx.Context) (*CaptchaReply, error)

func (*UseCase) UserLogout

func (u *UseCase) UserLogout(ctx kratosx.Context) error

func (*UseCase) UserRefreshToken

func (u *UseCase) UserRefreshToken(ctx kratosx.Context) (string, error)

type User

type User struct {
	types.BaseModel
	DepartmentId uint32                 `json:"department_id"`
	RoleId       uint32                 `json:"role_id"`
	Name         string                 `json:"name"`
	Nickname     string                 `json:"nickname"`
	Gender       string                 `json:"gender"`
	Phone        string                 `json:"phone"`
	Password     string                 `json:"password"`
	Avatar       string                 `json:"avatar"`
	Email        string                 `json:"email"`
	Status       *bool                  `json:"status"`
	Disabled     *string                `json:"disabled"`
	LastLogin    int64                  `json:"last_login"`
	Token        string                 `json:"token"`
	Role         *role.Role             `json:"role"`
	Department   *department.Department `json:"department"`
	Roles        []*role.Role           `json:"roles" gorm:"many2many:user_role"`
	Jobs         []*job.Job             `json:"jobs" gorm:"many2many:user_job"`
	UserRoles    []*UserRole            `json:"user_roles"`
	UserJobs     []*UserJob             `json:"user_jobs"`
}

type UserJob

type UserJob struct {
	types.CreateModel
	JobID  uint32 `json:"job_id"`
	UserID uint32 `json:"user_id"`
}

type UserLoginRequest

type UserLoginRequest struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	CaptchaId string `json:"captcha_id"`
	Captcha   string `json:"captcha"`
}

type UserRole

type UserRole struct {
	types.CreateModel
	RoleID uint32 `json:"role_id"`
	UserID uint32 `json:"user_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL