working commit

This commit is contained in:
2026-02-12 12:00:17 +02:00
parent ae15bddb15
commit b279687623
20 changed files with 639 additions and 192 deletions
+7 -7
View File
@@ -9,10 +9,10 @@ import (
func (db *Database) InsertAccount(ctx context.Context, account *descr.Account) error {
var err error
request := `INSERT INTO accounts(id, username, passhash, disabled, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6)`
_, err = db.db.Exec(request, account.ID, account.Username, account.Passhash,
account.Disabled, account.CreatedAt, account.UpdatedAt)
request := `INSERT INTO accounts(id, username, passhash, disabled, created_at, updated_at, created_by, updated_by)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`
_, err = db.db.Exec(request, account.ID, account.Username, account.Passhash, account.Disabled,
account.CreatedAt, account.UpdatedAt, account.CreatedBy, account.UpdatedBy)
if err != nil {
return err
}
@@ -21,8 +21,8 @@ func (db *Database) InsertAccount(ctx context.Context, account *descr.Account) e
func (db *Database) UpdateAccountByID(ctx context.Context, accountID string, account *descr.Account) error {
var err error
request := `UPDATE accounts SET username = $1, passhash = $2, disabled = $3, updated_at = $4 WHERE id = $6`
_, err = db.db.Exec(request, account.Username, account.Passhash, account.Disabled, account.UpdatedAt, accountID)
request := `UPDATE accounts SET username = $1, passhash = $2, disabled = $3, updated_at = $4, updated_by = $5 WHERE id = $6`
_, err = db.db.Exec(request, account.Username, account.Passhash, account.Disabled, account.UpdatedAt, account.UpdatedBy, accountID)
if err != nil {
return err
}
@@ -31,7 +31,7 @@ func (db *Database) UpdateAccountByID(ctx context.Context, accountID string, acc
func (db *Database) ReducedListAccounts(ctx context.Context) ([]descr.Account, error) {
var err error
request := `SELECT id, username, disabled, created_at, updated_at FROM accounts`
request := `SELECT id, username, disabled, created_at, updated_at, created_by, updated_by FROM accounts`
res := make([]descr.Account, 0)
err = db.db.Select(&res, request)
if err != nil {