feat: accounts settings page
This commit is contained in:
parent
0baacb4b28
commit
c327189afd
8 changed files with 278 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ type AccountRepository interface {
|
|||
Create(account *model.Account) error
|
||||
ByID(id string) (*model.Account, error)
|
||||
BySpaceID(spaceID string) ([]*model.Account, error)
|
||||
Rename(id, name string) error
|
||||
Delete(id string) error
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +53,12 @@ func (r *accountRepository) BySpaceID(spaceID string) ([]*model.Account, error)
|
|||
return accounts, nil
|
||||
}
|
||||
|
||||
func (r *accountRepository) Rename(id, name string) error {
|
||||
query := `UPDATE accounts SET name = $1, updated_at = CURRENT_TIMESTAMP WHERE id = $2;`
|
||||
_, err := r.db.Exec(query, name, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *accountRepository) Delete(id string) error {
|
||||
query := `DELETE FROM accounts WHERE id = $1;`
|
||||
_, err := r.db.Exec(query, id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue