reorder fields
parent
c6998d49c5
commit
e28e4a8ba3
|
@ -10,13 +10,14 @@ import (
|
||||||
|
|
||||||
type Attribute struct {
|
type Attribute struct {
|
||||||
ID uint `gorm:"primaryKey"`
|
ID uint `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
|
|
||||||
Key string `gorm:"unique;not null"`
|
Key string `gorm:"unique;not null"`
|
||||||
Description string
|
Description string
|
||||||
Default string
|
|
||||||
Value string
|
Value string
|
||||||
|
Default string
|
||||||
|
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
var l zerolog.Logger
|
var l zerolog.Logger
|
||||||
|
|
|
@ -10,8 +10,6 @@ import (
|
||||||
//Group enum of user permission groups
|
//Group enum of user permission groups
|
||||||
type Group struct {
|
type Group struct {
|
||||||
ID uint `gorm:"primaryKey"`
|
ID uint `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
|
|
||||||
// Name starting with '*' is reserved and starting with '_' is internal
|
// Name starting with '*' is reserved and starting with '_' is internal
|
||||||
Name string `gorm:"unique;not null"`
|
Name string `gorm:"unique;not null"`
|
||||||
|
@ -21,6 +19,9 @@ type Group struct {
|
||||||
|
|
||||||
//extra fields
|
//extra fields
|
||||||
GRPF1 string
|
GRPF1 string
|
||||||
|
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (grp *Group) BeforeSave(tx *gorm.DB) (err error) {
|
func (grp *Group) BeforeSave(tx *gorm.DB) (err error) {
|
||||||
|
|
10
auth/user.go
10
auth/user.go
|
@ -12,8 +12,6 @@ import (
|
||||||
//User User model
|
//User User model
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string `gorm:"primaryKey"`
|
ID string `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
|
|
||||||
Username string `gorm:"unique;not null"`
|
Username string `gorm:"unique;not null"`
|
||||||
Password string `json:"-"`
|
Password string `json:"-"`
|
||||||
|
@ -27,17 +25,21 @@ type User struct {
|
||||||
|
|
||||||
Groups []*Group `gorm:"many2many:user_groups;"`
|
Groups []*Group `gorm:"many2many:user_groups;"`
|
||||||
Profile Profile
|
Profile Profile
|
||||||
|
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// Profile user extended information
|
// Profile user extended information
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
ID uint `gorm:"primaryKey"`
|
ID uint `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
UserID string
|
UserID string
|
||||||
|
|
||||||
DisplayName string
|
DisplayName string
|
||||||
Email string
|
Email string
|
||||||
|
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeforeCreate set UID
|
// BeforeCreate set UID
|
||||||
|
|
|
@ -21,7 +21,6 @@ const (
|
||||||
|
|
||||||
type History struct {
|
type History struct {
|
||||||
ID uint `gorm:"primaryKey"`
|
ID uint `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
|
||||||
Module string
|
Module string
|
||||||
Type string
|
Type string
|
||||||
Caller string
|
Caller string
|
||||||
|
@ -36,6 +35,8 @@ type History struct {
|
||||||
Group string
|
Group string
|
||||||
// Scope for users to narrow down view point
|
// Scope for users to narrow down view point
|
||||||
Scope string
|
Scope string
|
||||||
|
|
||||||
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *History) BeforeCreate(tx *gorm.DB) (err error) {
|
func (h *History) BeforeCreate(tx *gorm.DB) (err error) {
|
||||||
|
|
Loading…
Reference in New Issue