From 7d098633937a219aa96f1574fa9cc15aec1dd9fe Mon Sep 17 00:00:00 2001 From: Daenney Date: Mon, 27 Mar 2023 16:02:26 +0200 Subject: [feature] Add list command to admin account (#1648) * [feature] Add list command to admin account Relates to: #388 * Print booleans as yes/no too --- internal/db/bundb/user.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/db/bundb/user.go') diff --git a/internal/db/bundb/user.go b/internal/db/bundb/user.go index 68fdb0652..b5dae1573 100644 --- a/internal/db/bundb/user.go +++ b/internal/db/bundb/user.go @@ -122,6 +122,20 @@ func (u *userDB) GetUserByConfirmationToken(ctx context.Context, confirmationTok }, confirmationToken) } +func (u *userDB) GetAllUsers(ctx context.Context) ([]*gtsmodel.User, db.Error) { + var users []*gtsmodel.User + q := u.conn. + NewSelect(). + Model(&users). + Relation("Account") + + if err := q.Scan(ctx); err != nil { + return nil, u.conn.ProcessError(err) + } + + return users, nil +} + func (u *userDB) PutUser(ctx context.Context, user *gtsmodel.User) db.Error { return u.state.Caches.GTS.User().Store(user, func() error { _, err := u.conn. -- cgit v1.2.3