From befc288efe44783aae623eb2883166e2e8e3850e Mon Sep 17 00:00:00 2001 From: bean Date: Wed, 22 May 2024 00:55:44 +0700 Subject: [PATCH 1/2] fix: use discord username as optional in querying discord accounts (#705) Co-authored-by: Bean Vo --- pkg/store/discordaccount/discord_account.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/store/discordaccount/discord_account.go b/pkg/store/discordaccount/discord_account.go index 6045cd30d..f6c57613f 100644 --- a/pkg/store/discordaccount/discord_account.go +++ b/pkg/store/discordaccount/discord_account.go @@ -56,9 +56,9 @@ func (r *store) UpdateSelectedFieldsByID(db *gorm.DB, id string, updateModel mod return &discordAccount, db.Model(&discordAccount).Where("id = ?", id).Select(updatedFields).Updates(updateModel).Error } -// ListByMemoUsername gets a list of discord accounts by memo usernames +// ListByMemoUsername gets a list of discord accounts by memo usernames, if memo username is not found, it will try to find by discord username func (r *store) ListByMemoUsername(db *gorm.DB, usernames []string) ([]model.DiscordAccount, error) { var cms []model.DiscordAccount - err := db.Where("memo_username IN (?)", usernames).Find(&cms).Error + err := db.Where("memo_username IN (?) OR discord_username IN (?)", usernames, usernames).Find(&cms).Error return cms, err } From 7e30ba1f96cddd6d0b20b68c2645cdd6f273827d Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 22 May 2024 00:58:26 +0700 Subject: [PATCH 2/2] chore: update logs --- pkg/handler/invoice/invoice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/handler/invoice/invoice.go b/pkg/handler/invoice/invoice.go index f9fbcc173..a0ea4847a 100644 --- a/pkg/handler/invoice/invoice.go +++ b/pkg/handler/invoice/invoice.go @@ -198,7 +198,7 @@ func (h *handler) Send(c *gin.Context) { _, err = h.controller.Invoice.Send(iv) if err != nil { - l.Error(err, "failed to parse request to invoice model") + l.Error(err, "failed to send invoice") errs.ConvertControllerErr(c, err) return }