Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
DB ...
View Source
var Enforcer *casbin.Enforcer
Enforcer ...
View Source
var RedisClient *redis.Client
RedisClient ...
View Source
var RedisContext = context.Background()
RedisContext ...
Functions ¶
This section is empty.
Types ¶
type Building ¶
type Building struct {
Model
Building string `json:"building" gorm:"unique"`
Locations []Location `json:"locations" gorm:"foreignkey:BuildingID"`
}
Building ...
type Department ¶
type Department struct {
Model
Department string `json:"department"`
OU string `json:"ou" gorm:"unique"`
InstitutionID uint `json:"-"`
}
Department ...
type DepartmentEmployee ¶
type DepartmentEmployee struct {
Model
EmployeeUserID uint `json:"-"`
DepartmentID uint `json:"-"`
Department Department `json:"department"`
Employee User `json:"employee" gorm:"foreignkey:EmployeeUserID"`
}
DepartmentEmployee ...
type Employee ¶
type Employee struct {
UserID uint `json:"user_id" gorm:"primary_key;auto_increment:false"`
Name string `json:"name"`
Account string `json:"account" gorm:"unique"`
Title string `json:"title"`
Departments []Department `json:"departments" gorm:"many2many:department_employees"`
}
Employee ...
type Follower ¶
type Follower struct {
VisitID uint `json:"visit_id" gorm:"primary_key;auto_increment:false"`
Name string `json:"name" gorm:"primary_key"`
}
Follower ...
type Guest ¶
type Guest struct {
UserID uint `json:"user_id" gorm:"primary_key;auto_increment:false"`
Name string `json:"name"`
Phone string `json:"phone"`
PhoneVerify bool `json:"phone_verify" gorm:"default:false"`
PhoneToken string `json:"phone_token"`
PhoneOTP string `json:"phone_otp" gorm:"-"`
IDCard string `json:"id_card"`
IDCardVerify bool `json:"id_card_verify" gorm:"default:false"`
VisitedDepartments []DepartmentEmployee `json:"visited_departments" gorm:"many2many:visits"`
}
Guest ...
type Institution ¶
type Institution struct {
Model
Institution string `json:"institution"`
OU string `json:"ou" gorm:"unique"`
Departments []Department `json:"departments" gorm:"foreignkey:InstitutionID"`
}
Institution ...
type Location ¶
type Location struct {
Model
Location string `json:"location"`
BuildingID uint `json:"-"`
Building Building `json:"building" gorm:"foreignkey:BuildingID"`
}
Location ...
type MaskTarget ¶
type MaskTarget int
MaskTarget ...
const ( // RegisterMask ... RegisterMask MaskTarget = iota // VisitMask ... VisitMask )
type Model ¶
type Model struct {
ID uint `json:"id" gorm:"primary_key"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at" sql:"index"`
}
Model override gorm.Model
type Result ¶
type Result struct {
Status ResultStatus `json:"status"`
Info []string `json:"info"`
Data interface{} `json:"data"`
Time time.Time `json:"time"`
Logger *log.Entry `json:"-"`
}
Result ...
type ResultStatus ¶
type ResultStatus string
ResultStatus ...
const ( // Success ... Success ResultStatus = "success" // Failure ... Failure ResultStatus = "failure" )
type TccgUser ¶
type TccgUser struct {
Account string `json:"account" binding:"required"`
Password string `json:"password" binding:"required"`
Name string `json:"name"`
Title string `json:"title"`
Enabled bool `json:"enabled"`
OU string `json:"ou"`
}
TccgUser ...
type TcpassVisit ¶
type TcpassVisit struct {
Model
DepartmentEmployeeID uint `json:"-"`
LocationID uint `json:"location_id"`
DepartmentEmployee DepartmentEmployee `json:"department_employee" gorm:"DepartmentEmployeeID"`
Location Location `json:"location" gorm:"foreignkey:LocationID"`
UUID string `json:"uuid"`
}
TcpassVisit ...
type User ¶
type User struct {
Model
Username string `json:"username" gorm:"unique;not null" binding:"required"`
Password string `json:"password" gorm:"-"`
Name string `json:"name"`
Type UserType `json:"type"`
Employee Employee `json:"employee" gorm:"foreignkey:UserID"`
Guest Guest `json:"guest" gorm:"foreignkey:UserID"`
Token Token `json:"token" gorm:"-"`
}
User ...
type Visit ¶
type Visit struct {
Model
GuestUserID uint `json:"-"`
DepartmentEmployeeID uint `json:"-"`
LocationID uint `json:"location_id"`
Guest User `json:"guest" gorm:"foreignkey:GuestUserID"`
DepartmentEmployee DepartmentEmployee `json:"department_employee" gorm:"DepartmentEmployeeID"`
Location Location `json:"location" gorm:"foreignkey:LocationID"`
Followers []Follower `json:"followers" gorm:"foreignkey:VisitID"`
}
Visit ...
Click to show internal directories.
Click to hide internal directories.