feat(account): use token instead of id for rename

This commit is contained in:
Leon
2025-12-09 15:47:55 +08:00
parent 6c0b8c7d7a
commit f122a6170d
3 changed files with 24 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ func (ar *AccountRepository) CreateAccount(account *Account) error {
return nil
}
func (ar *AccountRepository) RenameByID(id uint, newUsername string) error {
func (ar *AccountRepository) Rename(id uint, newUsername string) error {
if err := ar.db.Model(&Account{}).Where("id = ?", id).Update("username", newUsername).Error; err != nil {
return err
}