🐛 Fix didn't preload sticker pack in lookup

This commit is contained in:
LittleSheep 2024-09-16 20:35:59 +08:00
parent eabf0fdea1
commit 241d61758a

View File

@ -14,7 +14,8 @@ func GetStickerWithAlias(alias string) (models.Sticker, error) {
if err := database.C.
Joins(fmt.Sprintf("LEFT JOIN %ssticker_packs pk ON pack_id = pk.id", prefix)).
Where("CONCAT(pk.prefix, alias) = ?", alias).
Preload("Attachment").First(&sticker).Error; err != nil {
Preload("Attachment").Preload("Pack").
First(&sticker).Error; err != nil {
return sticker, err
}
return sticker, nil