1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Add API endpoint to fetch unread and read counters

This commit is contained in:
Pascal Noisette 2022-05-21 20:44:56 +02:00 committed by GitHub
parent 953c1742e0
commit d118aa8649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 0 deletions

View file

@ -158,6 +158,14 @@ func (s *Storage) FeedsWithCounters(userID int64) (model.Feeds, error) {
return getFeedsSorted(builder)
}
// Return read and unread count.
func (s *Storage) FetchCounters(userID int64) (model.FeedCounters, error) {
builder := NewFeedQueryBuilder(s, userID)
builder.WithCounters()
reads, unreads, err := builder.fetchFeedCounter()
return model.FeedCounters{ReadCounters: reads, UnreadCounters: unreads}, err
}
// FeedsByCategoryWithCounters returns all feeds of the given user/category with counters of read and unread entries.
func (s *Storage) FeedsByCategoryWithCounters(userID, categoryID int64) (model.Feeds, error) {
builder := NewFeedQueryBuilder(s, userID)