Skip to content

Commit

Permalink
fix: use discord username as optional in querying discord accounts (#705
Browse files Browse the repository at this point in the history
)

Co-authored-by: Bean Vo <[email protected]>
  • Loading branch information
baenv and Bean Vo authored May 21, 2024
1 parent fc957bf commit befc288
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/store/discordaccount/discord_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit befc288

Please sign in to comment.