Realm directory

This commit is contained in:
2024-02-05 19:25:56 +08:00
parent 0c8afb2bae
commit 22ad495308
13 changed files with 212 additions and 33 deletions

View File

@ -77,30 +77,6 @@ WHERE t.id IN (?)`, prefix, prefix, prefix), postIds).Scan(&reactInfo)
}
func NewPost(
user models.Account,
alias, title, content string,
attachments []models.Attachment,
categories []models.Category,
tags []models.Tag,
publishedAt *time.Time,
replyTo, repostTo *uint,
) (models.Post, error) {
return NewPostWithRealm(
user,
nil,
alias,
title,
content,
attachments,
categories,
tags,
publishedAt,
replyTo,
repostTo,
)
}
func NewPostWithRealm(
user models.Account,
realm *models.Realm,
alias, title, content string,

View File

@ -5,7 +5,16 @@ import (
"code.smartsheep.studio/hydrogen/interactive/pkg/models"
)
func ListRealms(user models.Account) ([]models.Realm, error) {
func ListRealm() ([]models.Realm, error) {
var realms []models.Realm
if err := database.C.Find(&realms).Error; err != nil {
return realms, err
}
return realms, nil
}
func ListRealmWithUser(user models.Account) ([]models.Realm, error) {
var realms []models.Realm
if err := database.C.Where(&models.Realm{AccountID: user.ID}).Find(&realms).Error; err != nil {
return realms, err