mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
query limits on entries
This commit is contained in:
@@ -118,6 +118,13 @@ func (e *Rss) Feed(ctx context.Context, req *pb.FeedRequest, rsp *pb.FeedRespons
|
||||
feed := new(pb.Feed)
|
||||
id := tenantID + "/" + idFromName(req.Name)
|
||||
q := model.QueryEquals("ID", id)
|
||||
|
||||
// get the feed
|
||||
if err := e.feeds.Read(q, feed); err != nil {
|
||||
return errors.InternalServerError("rss.feeds", "could not read feed")
|
||||
}
|
||||
|
||||
q = e.entriesURLIndex.ToQuery(feed.Url)
|
||||
q.Limit = int64(25)
|
||||
q.Order = model.Order{
|
||||
Type: model.OrderTypeDesc,
|
||||
@@ -134,11 +141,6 @@ func (e *Rss) Feed(ctx context.Context, req *pb.FeedRequest, rsp *pb.FeedRespons
|
||||
q.Order.Type = model.OrderTypeAsc
|
||||
}
|
||||
|
||||
// get the feed
|
||||
if err := e.feeds.Read(q, feed); err != nil {
|
||||
return errors.InternalServerError("rss.feeds", "could not read feed")
|
||||
}
|
||||
|
||||
// get the entries for each
|
||||
return e.entries.Read(e.entriesURLIndex.ToQuery(feed.Url), &rsp.Entries)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user