feat: accounts settings page

This commit is contained in:
juancwu 2026-05-03 18:19:27 +00:00
commit c327189afd
8 changed files with 278 additions and 1 deletions

View file

@ -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)