Remove FetchOneByRoleId method and its corresponding SQL constant from the account repository to streamline account management functionality.
Some checks failed
ci/woodpecker/push/lint Pipeline failed
ci/woodpecker/push/tests Pipeline was successful
ci/woodpecker/push/build unknown status

This commit is contained in:
qpismont 2025-04-17 20:24:20 +00:00
parent 1f31d9c78e
commit edc9aeb471
2 changed files with 0 additions and 16 deletions

View file

@ -62,18 +62,3 @@ func (r *Repository) FetchOneByUsername(username string) (*domain.Account, error
return &account, nil
}
func (r *Repository) FetchOneByRoleId(roleId int) (*domain.Account, error) {
var account domain.Account
err := r.db.Get(&account, SqlFetchOneByRoleId, roleId)
if err != nil {
if err == sql.ErrNoRows {
return nil, nil
} else {
return nil, err
}
}
return &account, nil
}

View file

@ -4,5 +4,4 @@ const (
SqlInsert = "INSERT INTO accounts (username, password, role_id) VALUES ($1, $2, $3) RETURNING id"
SqlFetchOneByUsername = "SELECT * FROM accounts WHERE username = $1"
SqlFetchOneById = "SELECT * FROM accounts WHERE id = $1"
SqlFetchOneByRoleId = "SELECT * FROM accounts WHERE role_id = $1"
)