model

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeishuUserData added in v0.0.29

type FeishuUserData struct {
	AccessToken      string `bson:"access_token" json:"access_token"`
	TokenType        string `bson:"token_type" json:"token_type"`
	ExpiresIn        uint64 `bson:"expires_in" json:"expires_in"`
	Name             string `bson:"name" json:"name"`
	EnName           string `bson:"en_name" json:"en_name"`
	AvatarUrl        string `bson:"avatar_url" json:"avatar_url"`
	AvatarThumb      string `bson:"avatar_thumb" json:"avatar_thumb"`
	AvatarMiddle     string `bson:"avatar_middle" json:"avatar_middle"`
	AvatarBig        string `bson:"avatar_big" json:"avatar_big"`
	OpenId           string `bson:"open_id" json:"open_id"`
	UnionId          string `bson:"union_id" json:"union_id"`
	Email            string `bson:"email" json:"email"`
	EnterpriseEmail  string `bson:"enterprise_email" json:"enterprise_email"`
	UserId           string `bson:"user_id" json:"user_id"`
	Mobile           string `bson:"mobile" json:"mobile"`
	TenantKey        string `bson:"tenant_key" json:"tenant_key"`
	RefreshExpiresIn uint64 `bson:"refresh_expires_in" json:"refresh_expires_in"`
	RefreshToken     string `bson:"refresh_token" json:"refresh_token"`
	Sid              string `bson:"sid" json:"sid"`
}

参数详情 https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/authen-v1/access_token/create

type LoginData added in v0.0.29

type LoginData struct {
	Country   string `bson:"country" json:"country"`
	Province  string `bson:"province" json:"province"`
	City      string `bson:"city" json:"city"`
	Isp       string `bson:"isp" json:"isp"`
	UserAgent string `bson:"user_agent"`
}

type LoginLog added in v0.0.29

type LoginLog struct {
	Timestamp time.Time     `bson:"timestamp"`
	Metadata  LoginMetadata `bson:"metadata"`
	Data      LoginData     `bson:"data"`
}

func NewLoginLog added in v0.0.29

func NewLoginLog(metadata LoginMetadata, data LoginData) *LoginLog

type LoginMetadata added in v0.0.29

type LoginMetadata struct {
	UserID  string `bson:"user_id"`
	Email   string `bson:"email"`
	TokenId string `bson:"token_id"`
	Ip      string `bson:"ip"`
	Channel string `bson:"channel" json:"channel"`
}

type Project added in v0.0.29

type Project struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name       string             `bson:"name" json:"name"`
	Namespace  string             `bson:"namespace" json:"namespace"`
	Secret     string             `bson:"secret" json:"secret"`
	Entry      []string           `bson:"entry" json:"entry"`
	Expire     int64              `bson:"expire" json:"expire"`
	Status     bool               `bson:"status" json:"status"`
	CreateTime time.Time          `bson:"create_time" json:"create_time"`
	UpdateTime time.Time          `bson:"update_time" json:"update_time"`
}

func NewProject added in v0.0.29

func NewProject(name string, namespace string) *Project

type User

type User struct {
	ID          primitive.ObjectID   `bson:"_id,omitempty" json:"_id"`
	Email       string               `bson:"email" json:"email"`
	Roles       []primitive.ObjectID `bson:"roles" json:"-"`
	Password    string               `bson:"password" json:"-"`
	Name        string               `bson:"name" json:"name"`
	Avatar      string               `bson:"avatar" json:"avatar"`
	BackupEmail string               `bson:"backup_email" json:"backup_email"`
	Feishu      FeishuUserData       `bson:"feishu" json:"feishu"`
	Sessions    int64                `bson:"sessions" json:"sessions"`
	Last        UserLast             `bson:"last" json:"last"`
	Status      bool                 `bson:"status" json:"status"`
	CreateTime  time.Time            `bson:"create_time" json:"create_time"`
	UpdateTime  time.Time            `bson:"update_time" json:"update_time"`
}

func NewUser

func NewUser(email string, password string) *User

type UserLast added in v0.0.29

type UserLast struct {
	Timestamp time.Time `bson:"timestamp" json:"timestamp"`
	Ip        string    `bson:"ip" json:"ip"`
	Country   string    `bson:"country" json:"country"`
	Province  string    `bson:"province" json:"province"`
	City      string    `bson:"city" json:"city"`
	Isp       string    `bson:"isp" json:"isp"`
}

Jump to

Keyboard shortcuts

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