♻️ Move realm system to Passport
This commit is contained in:
@ -2,26 +2,24 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Account profiles basically fetched from Hydrogen.Identity
|
||||
// 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"`
|
||||
Nick string `json:"nick"`
|
||||
Avatar string `json:"avatar"`
|
||||
Banner string `json:"banner"`
|
||||
Description string `json:"description"`
|
||||
EmailAddress string `json:"email_address"`
|
||||
PowerLevel int `json:"power_level"`
|
||||
Moments []Moment `json:"moments" gorm:"foreignKey:AuthorID"`
|
||||
Articles []Article `json:"articles" gorm:"foreignKey:AuthorID"`
|
||||
Attachments []Attachment `json:"attachments" gorm:"foreignKey:AuthorID"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
RealmIdentities []RealmMember `json:"identities"`
|
||||
Realms []Realm `json:"realms"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
Name string `json:"name"`
|
||||
Nick string `json:"nick"`
|
||||
Avatar string `json:"avatar"`
|
||||
Banner string `json:"banner"`
|
||||
Description string `json:"description"`
|
||||
EmailAddress string `json:"email_address"`
|
||||
PowerLevel int `json:"power_level"`
|
||||
Moments []Moment `json:"moments" gorm:"foreignKey:AuthorID"`
|
||||
Articles []Article `json:"articles" gorm:"foreignKey:AuthorID"`
|
||||
Attachments []Attachment `json:"attachments" gorm:"foreignKey:AuthorID"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
}
|
||||
|
||||
type AccountMembership struct {
|
||||
|
@ -1,30 +1,16 @@
|
||||
package models
|
||||
|
||||
type RealmType = int
|
||||
|
||||
const (
|
||||
RealmTypePublic = RealmType(iota)
|
||||
RealmTypeRestricted
|
||||
RealmTypePrivate
|
||||
)
|
||||
|
||||
// Realm profiles basically fetched from Hydrogen.Passport
|
||||
// But cache at here for better usage and database relations
|
||||
type Realm struct {
|
||||
BaseModel
|
||||
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Articles []Article `json:"article"`
|
||||
Moments []Moment `json:"moments"`
|
||||
Members []RealmMember `json:"members"`
|
||||
RealmType RealmType `json:"realm_type"`
|
||||
AccountID uint `json:"account_id"`
|
||||
}
|
||||
|
||||
type RealmMember struct {
|
||||
BaseModel
|
||||
|
||||
RealmID uint `json:"realm_id"`
|
||||
AccountID uint `json:"account_id"`
|
||||
Realm Realm `json:"realm"`
|
||||
Account Account `json:"account"`
|
||||
Alias string `json:"alias"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Articles []Article `json:"article"`
|
||||
Moments []Moment `json:"moments"`
|
||||
IsPublic bool `json:"is_public"`
|
||||
IsCommunity bool `json:"is_community"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user