🎉 Init project from scratch
This commit is contained in:
14
pkg/models/accounts.go
Normal file
14
pkg/models/accounts.go
Normal file
@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
// Account profiles basically fetched from Hydrogen.Passport
|
||||
// But cache at here for better usage
|
||||
// At the same time this model can make relations between local models
|
||||
type Account struct {
|
||||
BaseModel
|
||||
|
||||
Name string `json:"name"`
|
||||
Avatar string `json:"avatar"`
|
||||
EmailAddress string `json:"email_address"`
|
||||
PowerLevel int `json:"power_level"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
}
|
17
pkg/models/base.go
Normal file
17
pkg/models/base.go
Normal file
@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type JSONMap = datatypes.JSONType[map[string]any]
|
||||
|
||||
type BaseModel struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
Reference in New Issue
Block a user