From ba6e827cf8d65012b45a4a8fb462f08602ffc739 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 9 Mar 2025 20:59:09 +0800 Subject: [PATCH] :bug: Fix flags --- pkg/internal/services/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/internal/services/flags.go b/pkg/internal/services/flags.go index d458002..c0dfeec 100644 --- a/pkg/internal/services/flags.go +++ b/pkg/internal/services/flags.go @@ -9,7 +9,7 @@ import ( func NewFlag(post models.Post, account uint) (models.PostFlag, error) { var flag models.PostFlag - if err := database.C.Where("post_id = ? AND account_id = ?", post.ID, account).Error; err == nil { + if err := database.C.Where("post_id = ? AND account_id = ?", post.ID, account).First(&flag).Error; err == nil { return flag, fmt.Errorf("flag already exists") } flag = models.PostFlag{