start moving some database stuff around

This commit is contained in:
tsmethurst 2021-08-17 11:18:43 +02:00
commit f409f7c65a
43 changed files with 1230 additions and 1223 deletions

View file

@ -133,7 +133,7 @@ func (p *processor) Delete(account *gtsmodel.Account, origin string) error {
var maxID string
selectStatusesLoop:
for {
statuses, err := p.db.GetStatusesForAccount(account.ID, 20, false, maxID, false, false)
statuses, err := p.db.GetAccountStatuses(account.ID, 20, false, maxID, false, false)
if err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
// no statuses left for this instance so we're done
@ -147,7 +147,7 @@ selectStatusesLoop:
for i, s := range statuses {
// pass the status delete through the client api channel for processing
s.GTSAuthorAccount = account
s.Account = account
l.Debug("putting status in the client api channel")
p.fromClientAPI <- gtsmodel.FromClientAPI{
APObjectType: gtsmodel.ActivityStreamsNote,

View file

@ -39,7 +39,7 @@ func (p *processor) FollowersGet(requestingAccount *gtsmodel.Account, targetAcco
followers := []gtsmodel.Follow{}
accounts := []apimodel.Account{}
if err := p.db.GetFollowersByAccountID(targetAccountID, &followers, false); err != nil {
if err := p.db.GetAccountFollowers(targetAccountID, &followers, false); err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
return accounts, nil
}

View file

@ -39,7 +39,7 @@ func (p *processor) FollowingGet(requestingAccount *gtsmodel.Account, targetAcco
following := []gtsmodel.Follow{}
accounts := []apimodel.Account{}
if err := p.db.GetFollowingByAccountID(targetAccountID, &following); err != nil {
if err := p.db.GetAccountFollowing(targetAccountID, &following); err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
return accounts, nil
}

View file

@ -37,7 +37,7 @@ func (p *processor) StatusesGet(requestingAccount *gtsmodel.Account, targetAccou
}
apiStatuses := []apimodel.Status{}
statuses, err := p.db.GetStatusesForAccount(targetAccountID, limit, excludeReplies, maxID, pinnedOnly, mediaOnly)
statuses, err := p.db.GetAccountStatuses(targetAccountID, limit, excludeReplies, maxID, pinnedOnly, mediaOnly)
if err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
return apiStatuses, nil