🐛 Fix lookup sticker via alias didn't preload attachment

This commit is contained in:
LittleSheep 2024-09-16 20:22:30 +08:00
parent 525a103a76
commit eabf0fdea1

View File

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