user

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadUser

func LoadUser() gin.HandlerFunc

func RegisterRouter

func RegisterRouter(g *gin.RouterGroup)

Types

type Handler

type Handler struct {
}

func (*Handler) EmailModify

func (*Handler) EmailModify() gin.HandlerFunc

func (*Handler) List

func (*Handler) List() gin.HandlerFunc

list godoc @Summary Show user list @Produce json @Param order_by query string false "OrderBy" @Param page query int false "Page" @Success 200 {object} response.List @Failure 400 {object} response.List @Failure 500 {object} response.List @Router /v1/user/ [GET]

func (*Handler) PasswordModify

func (*Handler) PasswordModify() gin.HandlerFunc

func (*Handler) ProfileModify

func (*Handler) ProfileModify() gin.HandlerFunc

func (*Handler) Register

func (*Handler) Register() gin.HandlerFunc

register godoc @Summary Register a account @Produce json @Param register body request.Register true "Register" @Success 200 {object} response.Register @Failure 400 {object} response.Register @Failure 500 {object} response.Register @Router /v1/user/ [POST]

func (*Handler) Show

func (*Handler) Show() gin.HandlerFunc

func (*Handler) SingleDelete

func (*Handler) SingleDelete() gin.HandlerFunc

func (*Handler) TeamApplicationList

func (*Handler) TeamApplicationList() gin.HandlerFunc

func (*Handler) TeamInvitationList

func (*Handler) TeamInvitationList() gin.HandlerFunc

func (*Handler) TeamList

func (*Handler) TeamList() gin.HandlerFunc

type RTeam

type RTeam struct {
	ID      uint   `json:"id"`
	Name    string `json:"name"`
	IsAdmin bool   `json:"is_admin,omitempty"`
}

func BindTeam

func BindTeam(db *gorm.DB, team *cpt.Team, user *cpt.User) *RTeam

func BindTeamList

func BindTeamList(db *gorm.DB, teams []cpt.Team, user *cpt.User) []*RTeam

type RTeamInvitationAndApplication

type RTeamInvitationAndApplication struct {
	TeamID uint      `json:"team_id"`
	Time   time.Time `json:"time"`
	Status uint      `json:"status"`
}

func BindTeamApplicationList

func BindTeamApplicationList(applications []cpt.TeamApplication) []*RTeamInvitationAndApplication

func BindTeamInvitationList

func BindTeamInvitationList(invitations []cpt.TeamInvitation) []*RTeamInvitationAndApplication

type RUser

type RUser struct {
	ID        uint          `json:"id"`
	Username  string        `json:"username"`
	Email     string        `json:"email,omitempty"`
	EmailHash string        `json:"email_hash"`
	Profile   *RUserProfile `json:"profile"`
	IsAdmin   bool          `json:"is_admin,omitempty"`
}

func BindList

func BindList(session *cpt.Session, users []cpt.User) []*RUser

func BindUser

func BindUser(session *cpt.Session, user *cpt.User) *RUser

type RUserProfile

type RUserProfile struct {
	Nickname    string `json:"nickname"`
	Page        string `json:"page"`
	Description string `json:"description"`
}

type ReqEmailModify

type ReqEmailModify struct {
	Email string `json:"email" validate:"email" binding:"email"`
}

type ReqPasswordModify

type ReqPasswordModify struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password" validate:"max=50,min=6" binding:"max=50,min=6"`
}

type ReqPermissionAdd

type ReqPermissionAdd struct {
	Permissions []string `json:"permissions"`
}

type ReqProfileModify

type ReqProfileModify struct {
	Nickname    *string `json:"nickname" validate:"omitempty,max=50,min=1" binding:"omitempty,max=50,min=1"`
	Page        *string `json:"page" validate:"omitempty,url" validate:"omitempty,url"`
	Description *string `json:"description"`
}

func (*ReqProfileModify) Bind

func (r *ReqProfileModify) Bind(p *cpt.UserProfile)

type ReqRegister

type ReqRegister struct {
	Username     string `json:"username" validate:"max=20,min=1,keyword" binding:"max=20,min=1,keyword"`
	Password     string `json:"password" validate:"max=50,min=6" binding:"max=50,min=6"`
	Email        string `json:"email" validate:"email" binding:"email"`
	EmailCaptcha string `json:"email_captcha,omitempty"`
}

type RespEmailHashShow

type RespEmailHashShow struct {
	Response
	EmailHash string `json:"email_hash"`
}

type RespList

type RespList struct {
	Response
	Users []*RUser `json:"users"`
}

type RespRegister

type RespRegister struct {
	Response
	UserID uint `json:"user_id,omitempty"`
}

type RespShow

type RespShow struct {
	Response
	User *RUser `json:"user"`
}

type RespTeamApplicationList

type RespTeamApplicationList struct {
	Response
	Applications []*RTeamInvitationAndApplication `json:"applications"`
}

type RespTeamInvitationList

type RespTeamInvitationList struct {
	Response
	Invitations []*RTeamInvitationAndApplication `json:"invitations"`
}

type RespTeamList

type RespTeamList struct {
	Response
	Teams []*RTeam `json:"teams"`
}

Jump to

Keyboard shortcuts

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