summaryrefslogtreecommitdiff
path: root/internal/db/account.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-02-25 13:16:30 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-25 12:16:30 +0000
commitc27b4d7ed02cdabac00c3ddedb8201b74f745ec6 (patch)
treed80f621241fd67a4e5de2d21a8c24776552175f5 /internal/db/account.go
parent[chore] Update gin to v1.9.0 (#1553) (diff)
downloadgotosocial-c27b4d7ed02cdabac00c3ddedb8201b74f745ec6.tar.xz
[feature] Client API endpoints + v. basic web view for pinned posts (#1547)
* implement status pin client api + web handler * make test names + comments more descriptive * don't use separate table for status pins * remove unused add + remove checking * tidy up + add some more tests
Diffstat (limited to 'internal/db/account.go')
-rw-r--r--internal/db/account.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/db/account.go b/internal/db/account.go
index 42a8c62b0..7989b9838 100644
--- a/internal/db/account.go
+++ b/internal/db/account.go
@@ -62,15 +62,29 @@ type Account interface {
// GetAccountStatusesCount is a shortcut for the common action of counting statuses produced by accountID.
CountAccountStatuses(ctx context.Context, accountID string) (int, Error)
+ // CountAccountPinned returns the total number of pinned statuses owned by account with the given id.
+ CountAccountPinned(ctx context.Context, accountID string) (int, Error)
+
// GetAccountStatuses is a shortcut for getting the most recent statuses. accountID is optional, if not provided
// then all statuses will be returned. If limit is set to 0, the size of the returned slice will not be limited. This can
// be very memory intensive so you probably shouldn't do this!
- // In case of no entries, a 'no entries' error will be returned
- GetAccountStatuses(ctx context.Context, accountID string, limit int, excludeReplies bool, excludeReblogs bool, maxID string, minID string, pinnedOnly bool, mediaOnly bool, publicOnly bool) ([]*gtsmodel.Status, Error)
+ //
+ // In the case of no statuses, this function will return db.ErrNoEntries.
+ GetAccountStatuses(ctx context.Context, accountID string, limit int, excludeReplies bool, excludeReblogs bool, maxID string, minID string, mediaOnly bool, publicOnly bool) ([]*gtsmodel.Status, Error)
+
+ // GetAccountPinnedStatuses returns ONLY statuses owned by the give accountID for which a corresponding StatusPin
+ // exists in the database. Statuses which are not pinned will not be returned by this function.
+ //
+ // Statuses will be returned in the order in which they were pinned, from latest pinned to oldest pinned (descending).
+ //
+ // In the case of no statuses, this function will return db.ErrNoEntries.
+ GetAccountPinnedStatuses(ctx context.Context, accountID string) ([]*gtsmodel.Status, Error)
// GetAccountWebStatuses is similar to GetAccountStatuses, but it's specifically for returning statuses that
// should be visible via the web view of an account. So, only public, federated statuses that aren't boosts
// or replies.
+ //
+ // In the case of no statuses, this function will return db.ErrNoEntries.
GetAccountWebStatuses(ctx context.Context, accountID string, limit int, maxID string) ([]*gtsmodel.Status, Error)
GetBookmarks(ctx context.Context, accountID string, limit int, maxID string, minID string) ([]*gtsmodel.StatusBookmark, Error)