🎉 Init project from scratch

This commit is contained in:
2024-02-01 23:26:17 +08:00
commit 434773976f
64 changed files with 1760 additions and 0 deletions

14
pkg/models/accounts.go Normal file
View 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
View 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"`
}