Realm permission check

This commit is contained in:
2024-02-09 12:36:39 +08:00
parent 798e78ff8e
commit 012ee55c3a
6 changed files with 92 additions and 20 deletions

View File

@ -8,18 +8,19 @@ import "time"
type Account struct {
BaseModel
Name string `json:"name"`
Nick string `json:"nick"`
Avatar string `json:"avatar"`
Description string `json:"description"`
EmailAddress string `json:"email_address"`
PowerLevel int `json:"power_level"`
Posts []Post `json:"posts" gorm:"foreignKey:AuthorID"`
Attachments []Attachment `json:"attachments" gorm:"foreignKey:AuthorID"`
LikedPosts []PostLike `json:"liked_posts"`
DislikedPosts []PostDislike `json:"disliked_posts"`
Realms []Realm `json:"realms"`
ExternalID uint `json:"external_id"`
Name string `json:"name"`
Nick string `json:"nick"`
Avatar string `json:"avatar"`
Description string `json:"description"`
EmailAddress string `json:"email_address"`
PowerLevel int `json:"power_level"`
Posts []Post `json:"posts" gorm:"foreignKey:AuthorID"`
Attachments []Attachment `json:"attachments" gorm:"foreignKey:AuthorID"`
LikedPosts []PostLike `json:"liked_posts"`
DislikedPosts []PostDislike `json:"disliked_posts"`
RealmIdentities []RealmMember `json:"identities"`
Realms []Realm `json:"realms"`
ExternalID uint `json:"external_id"`
}
type AccountMembership struct {

View File

@ -3,8 +3,17 @@ package models
type Realm struct {
BaseModel
Name string `json:"name"`
Description string `json:"description"`
Posts []Post `json:"posts"`
AccountID uint `json:"account_id"`
Name string `json:"name"`
Description string `json:"description"`
Posts []Post `json:"posts"`
Members []RealmMember `json:"members"`
IsPublic bool `json:"is_public"`
AccountID uint `json:"account_id"`
}
type RealmMember struct {
BaseModel
RealmID uint `json:"realm_id"`
AccountID uint `json:"account_id"`
}