user

package
v0.0.0-...-d125d34 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	List(ctx context.Context, query *q.Query) (int64, []*User, error)
	GetByID(ctx context.Context, id uint) (*User, error)
	UpdateByID(c context.Context, id uint, u *UpdateUserRequest) (*User, error)
	ListUserLinks(ctx context.Context, uid uint) ([]*Link, error)
	DeleteLinksByID(c context.Context, id uint) error
	// LoginWithPasswd checks inputted email & password
	LoginWithPasswd(ctx context.Context, request *LoginRequest) (*models.User, error)
}

func NewController

func NewController(param *param.Param) Controller
type Link struct {
	ID         uint   `json:"id"`
	Sub        string `json:"sub"`
	IdpID      uint   `json:"idpId"`
	UserID     uint   `json:"userId"`
	Name       string `json:"name"`
	Email      string `json:"email"`
	Unlinkable bool   `json:"unlinkable"`
}

type LoginRequest

type LoginRequest struct {
	Email string `json:"email"`
	// password handled by sha256
	Password string `json:"password"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	IsAdmin  *bool `json:"isAdmin"`
	IsBanned *bool `json:"isBanned"`
}

type User

type User struct {
	ID        uint      `json:"id,omitempty"`
	Name      string    `json:"name,omitempty"`
	FullName  string    `json:"fullName,omitempty"`
	Email     string    `json:"email,omitempty"`
	IsAdmin   bool      `json:"isAdmin"`
	IsBanned  bool      `json:"isBanned"`
	Phone     string    `json:"phone,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
}

Jump to

Keyboard shortcuts

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