Pagination

This commit is contained in:
2024-02-03 15:20:32 +08:00
parent 807f7cff46
commit 1f4164e72a
15 changed files with 394 additions and 226 deletions

View File

@ -1,5 +1,7 @@
package models
import "time"
// 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
@ -17,3 +19,11 @@ type Account struct {
Realms []Realm `json:"realms"`
ExternalID uint `json:"external_id"`
}
type AccountMembership struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FollowerID uint
FollowingID uint
}

View File

@ -12,7 +12,11 @@ type Post struct {
Categories []Category `gorm:"many2many:post_categories"`
LikedAccounts []PostLike `json:"liked_accounts"`
DislikedAccounts []PostDislike `json:"disliked_accounts"`
RepostTo *Post `json:"repost_to" gorm:"foreignKey:RepostID"`
ReplyTo *Post `json:"reply_to" gorm:"foreignKey:ReplyID"`
PublishedAt time.Time `json:"published_at"`
RepostID *uint `json:"repost_id"`
ReplyID *uint `json:"reply_id"`
RealmID *uint `json:"realm_id"`
AuthorID uint `json:"author_id"`
Author Account `json:"author"`