From 79b83026f56f19c5eac59129d7b4c3938982f3f8 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Thu, 31 Oct 2024 10:09:50 +0200 Subject: [PATCH] Fix issue with updating the same entity --- db/card.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/card.go b/db/card.go index 1287ab5..e287a64 100644 --- a/db/card.go +++ b/db/card.go @@ -47,7 +47,7 @@ func (c *Card) BeforeSave(tx *gorm.DB) error { return err } - if dup.ID != 0 { + if c.ID != dup.ID && dup.ID != 0 { return ERROR_CARD_NAME_NOT_UNIQUE }