models

package
v0.0.0-...-5112421 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateUser

func CreateOrUpdateUser(claims *auth.Claims)

CreateOrUpdateUser create or update user

Types

type Menu struct {
	Id string `bson:"id" json:"id"`

	TenantID string `bson:"tenantID" json:"tenantID"`

	Name string `bson:"name" json:"name"`

	Icon string `bson:"icon" json:"icon"`

	Path string `bson:"path" json:"path"`

	Access string `bson:"access" json:"access"`

	Status enum.Status `bson:"status" json:"status"`

	Routes []Menu `bson:"routes" json:"routes"`

	ParentKeys []string `bson:"parentKeys" json:"parentKeys"`

	Redirect string `bson:"redirect" json:"redirect"`

	Layout bool `bson:"layout" json:"layout"`

	Component string `bson:"component" json:"component"`

	CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
}

Menu <no value>

func (e *Menu) C() *mongo.Collection
func (e *Menu) Make()
func (Menu) TableName() string

type OnlyClient

type OnlyClient struct {
	Client config.OAuth2 `json:"client" bson:"client"`
}

type Role

type Role struct {
	ID        string      `bson:"_id" json:"id"`
	TenantID  string      `bson:"tenantID" json:"tenantID"`
	Name      string      `bson:"name" json:"name"`
	Status    enum.Status `bson:"status" json:"status"`
	Metadata  interface{} `bson:"metadata" json:"metadata"`
	CreatedAt time.Time   `bson:"createdAt" json:"createdAt"`
	UpdatedAt time.Time   `bson:"updatedAt" json:"updatedAt"`
}

func (*Role) C

func (e *Role) C() *mongo.Collection

func (*Role) Make

func (e *Role) Make()

func (Role) TableName

func (Role) TableName() string

type Tenant

type Tenant struct {
	ID          string        `json:"id" bson:"_id"`
	Name        string        `json:"name" bson:"name"`
	Contact     string        `json:"contact" bson:"contact"`
	System      bool          `json:"system" bson:"system"`
	Status      enum.Status   `json:"status" bson:"status"`
	Description string        `json:"description" bson:"description"`
	Domains     []string      `json:"domains" bson:"domains"`
	Client      config.OAuth2 `json:"client" bson:"client"`
	Metadata    interface{}   `json:"metadata" bson:"metadata"`
	ExpiredAt   time.Time     `json:"expiredAt" bson:"expiredAt" binding:"required"`
	CreatedAt   time.Time     `json:"createdAt" bson:"createdAt"`
	UpdatedAt   time.Time     `json:"updatedAt" bson:"updatedAt"`
}

Tenant 租户

func (*Tenant) C

func (e *Tenant) C() *mongo.Collection

func (*Tenant) GetClientByDomain

func (e *Tenant) GetClientByDomain(c context.Context, domain string) (store.OAuth2Configure, error)

GetClientByDomain 获取租户的client

func (*Tenant) Make

func (e *Tenant) Make()

func (Tenant) TableName

func (Tenant) TableName() string

type User

type User struct {
	ID        string      `bson:"_id" json:"id"`
	TenantID  string      `bson:"tenantID" json:"tenantID"`
	Username  string      `bson:"username" json:"username"`
	Nickname  string      `bson:"nickname" json:"nickname"`
	Avatar    string      `bson:"avatar" json:"avatar"`
	Email     string      `bson:"email" json:"email"`
	Phone     string      `bson:"phone" json:"phone"`
	Status    enum.Status `bson:"status" json:"status"`
	PWD       UserPwd     `bson:"pwd" json:"pwd"`
	Metadata  interface{} `bson:"metadata" json:"metadata"`
	CreatedAt time.Time   `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time   `json:"updatedAt" bson:"updatedAt"`
}

func (*User) C

func (e *User) C() *mongo.Collection

func (*User) Encrypt

func (e *User) Encrypt(pwd string) (err error)

func (*User) Make

func (e *User) Make()

func (User) TableName

func (User) TableName() string

func (*User) VerifyPassword

func (e *User) VerifyPassword(pwd string) bool

type UserPwd

type UserPwd struct {
	Salt string `bson:"salt" json:"salt"`
	Hash string `bson:"hash" json:"hash"`
}

Jump to

Keyboard shortcuts

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