further tidying up account service/repo

This commit is contained in:
ari melody 2026-07-31 11:04:36 +01:00
parent 32bcb894ee
commit 9e311df462
Signed by: ari
GPG key ID: CF99829C92678188
4 changed files with 26 additions and 38 deletions

View file

@ -120,21 +120,21 @@ func (repo *AccountRepositoryPostgres) Update(
return err
}
func (repo *AccountRepositoryPostgres) ChangeUsername(id string, username string) error {
func (repo *AccountRepositoryPostgres) UpdateUsername(id string, username string) error {
_, err := repo.db.Exec(
"UPDATE account SET username=$2 WHERE id=$1",
id, username,
)
return err
}
func (repo *AccountRepositoryPostgres) ChangePassword(id string, password string) error {
func (repo *AccountRepositoryPostgres) UpdatePassword(id string, password string) error {
_, err := repo.db.Exec(
"UPDATE account SET password=$2 WHERE id=$1",
id, password,
)
return err
}
func (repo *AccountRepositoryPostgres) ChangeEmail(id string, email string) error {
func (repo *AccountRepositoryPostgres) UpdateEmail(id string, email string) error {
_, err := repo.db.Exec(
"UPDATE account SET email=$2 WHERE id=$1",
id, email,
@ -145,7 +145,7 @@ func (repo *AccountRepositoryPostgres) RemoveEmail(id string) error {
_, err := repo.db.Exec("UPDATE account SET email=NULL WHERE id=$1", id)
return err
}
func (repo *AccountRepositoryPostgres) ChangeAvatarURL(id string, avatarURL string) error {
func (repo *AccountRepositoryPostgres) UpdateAvatarURL(id string, avatarURL string) error {
_, err := repo.db.Exec(
"UPDATE account SET avatar_url=$2 WHERE id=$1",
id, avatarURL,
@ -175,12 +175,7 @@ func (repo *AccountRepositoryPostgres) ResetFails(id string) error {
return err
}
func (repo *AccountRepositoryPostgres) Lock(id string) error {
_, err := repo.db.Exec("UPDATE account SET locked = true WHERE id=$1", id)
return err
}
func (repo *AccountRepositoryPostgres) Unlock(id string) error {
_, err := repo.db.Exec("UPDATE account SET locked = false, fail_attempts = 0 WHERE id=$1", id)
func (repo *AccountRepositoryPostgres) SetLocked(id string, locked bool) error {
_, err := repo.db.Exec("UPDATE account SET locked = $2 WHERE id=$1", id, locked)
return err
}