further tidying up account service/repo
This commit is contained in:
parent
32bcb894ee
commit
9e311df462
4 changed files with 26 additions and 38 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue