diff options
author | 2023-03-14 17:11:04 +0100 | |
---|---|---|
committer | 2023-03-14 16:11:04 +0000 | |
commit | 196cd88b1c7c44a337ca12f6a804f1bb7fa83c4a (patch) | |
tree | 9607d95b3f4f55a1ebfeded2f7aa9a3c8866bd0a /internal/db/bundb/instance.go | |
parent | [chore] fix + update swagger docs (#1622) (diff) | |
download | gotosocial-196cd88b1c7c44a337ca12f6a804f1bb7fa83c4a.tar.xz |
[feature] Allow admins to send test emails (#1620)
* [feature] Allow admins to send test emails
* implement unwrap on new error type
* add + use gtserror types
* GoToSocial Email Test -> GoToSocial Test Email
* add + use getInstance db call
* removed unused "unknown" error type
Diffstat (limited to 'internal/db/bundb/instance.go')
-rw-r--r-- | internal/db/bundb/instance.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/db/bundb/instance.go b/internal/db/bundb/instance.go index c40551212..b4bdeb1d9 100644 --- a/internal/db/bundb/instance.go +++ b/internal/db/bundb/instance.go @@ -97,6 +97,20 @@ func (i *instanceDB) CountInstanceDomains(ctx context.Context, domain string) (i return count, nil } +func (i *instanceDB) GetInstance(ctx context.Context, domain string) (*gtsmodel.Instance, db.Error) { + instance := >smodel.Instance{} + + if err := i.conn. + NewSelect(). + Model(instance). + Where("? = ?", bun.Ident("instance.domain"), domain). + Scan(ctx); err != nil { + return nil, i.conn.ProcessError(err) + } + + return instance, nil +} + func (i *instanceDB) GetInstancePeers(ctx context.Context, includeSuspended bool) ([]*gtsmodel.Instance, db.Error) { instances := []*gtsmodel.Instance{} |