🐛 Forgot add external id translator to feed API

This commit is contained in:
LittleSheep 2024-06-23 01:24:28 +08:00
parent c198565ced
commit 8e38735ad8

View File

@ -1,6 +1,7 @@
package api package api
import ( import (
"fmt"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "git.solsynth.dev/hydrogen/interactive/pkg/internal/models"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "git.solsynth.dev/hydrogen/interactive/pkg/internal/services"
@ -14,7 +15,11 @@ func listFeed(c *fiber.Ctx) error {
tx := database.C tx := database.C
if realmId > 0 { if realmId > 0 {
tx = services.FilterWithRealm(tx, uint(realmId)) if realm, err := services.GetRealmWithExtID(uint(realmId)); err != nil {
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("realm was not found: %v", err))
} else {
tx = services.FilterWithRealm(tx, realm.ID)
}
} }
if len(c.Query("authorId")) > 0 { if len(c.Query("authorId")) > 0 {