mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
smarter queries for other types
This commit is contained in:
@@ -114,11 +114,17 @@ public class CategoryREST extends AbstractResourceREST {
|
||||
if (feedCategory != null) {
|
||||
List<FeedCategory> childrenCategories = feedCategoryDAO
|
||||
.findAllChildrenCategories(getUser(), feedCategory);
|
||||
List<FeedEntryStatus> unreadEntries = feedEntryStatusDAO
|
||||
.findByCategories(childrenCategories, getUser(),
|
||||
unreadOnly, newerThanDate, offset, limit + 1,
|
||||
order, true);
|
||||
for (FeedEntryStatus status : unreadEntries) {
|
||||
List<FeedEntryStatus> list = null;
|
||||
if (unreadOnly) {
|
||||
list = feedEntryStatusDAO.findUnreadByCategories(
|
||||
childrenCategories, newerThanDate, offset,
|
||||
limit + 1, order, true);
|
||||
} else {
|
||||
list = feedEntryStatusDAO.findByCategories(
|
||||
childrenCategories, newerThanDate, offset,
|
||||
limit + 1, order, true);
|
||||
}
|
||||
for (FeedEntryStatus status : list) {
|
||||
entries.getEntries().add(
|
||||
Entry.build(status, applicationSettingsService
|
||||
.get().getPublicUrl()));
|
||||
|
||||
@@ -34,9 +34,10 @@ public class EntryREST extends AbstractResourceREST {
|
||||
@ApiParam(value = "Mark Request", required = true) MarkRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
Preconditions.checkNotNull(req.getFeedId());
|
||||
|
||||
feedEntryService.markEntry(getUser(), Long.valueOf(req.getId()),
|
||||
req.isRead());
|
||||
req.getFeedId(), req.isRead());
|
||||
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
@@ -48,9 +49,10 @@ public class EntryREST extends AbstractResourceREST {
|
||||
@ApiParam(value = "Star Request", required = true) StarRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
Preconditions.checkNotNull(req.getFeedId());
|
||||
|
||||
feedEntryService.starEntry(getUser(), Long.valueOf(req.getId()),
|
||||
req.isStarred());
|
||||
req.getFeedId(), req.isStarred());
|
||||
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@@ -100,10 +100,17 @@ public class FeedREST extends AbstractResourceREST {
|
||||
entries.setMessage(subscription.getFeed().getMessage());
|
||||
entries.setErrorCount(subscription.getFeed().getErrorCount());
|
||||
|
||||
List<FeedEntryStatus> unreadEntries = feedEntryStatusDAO
|
||||
.findBySubscription(subscription, unreadOnly,
|
||||
newerThanDate, offset, limit + 1, order, true);
|
||||
for (FeedEntryStatus status : unreadEntries) {
|
||||
List<FeedEntryStatus> list = null;
|
||||
if (unreadOnly) {
|
||||
list = feedEntryStatusDAO.findUnreadBySubscription(
|
||||
subscription, newerThanDate, offset, limit + 1, order,
|
||||
true);
|
||||
} else {
|
||||
list = feedEntryStatusDAO.findBySubscription(subscription,
|
||||
newerThanDate, offset, limit + 1, order, true);
|
||||
}
|
||||
|
||||
for (FeedEntryStatus status : list) {
|
||||
entries.getEntries().add(
|
||||
Entry.build(status, applicationSettingsService.get()
|
||||
.getPublicUrl()));
|
||||
@@ -202,16 +209,20 @@ public class FeedREST extends AbstractResourceREST {
|
||||
@POST
|
||||
@ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue")
|
||||
public Response queueForRefresh(@ApiParam(value = "Feed id") IDRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
// TODO evaluate if this is needed
|
||||
|
||||
// Preconditions.checkNotNull(req);
|
||||
// Preconditions.checkNotNull(req.getId());
|
||||
//
|
||||
// FeedSubscription sub = feedSubscriptionDAO.findById(getUser(),
|
||||
// req.getId());
|
||||
// if (sub != null) {
|
||||
// taskGiver.add(sub.getFeed());
|
||||
// return Response.ok(Status.OK).build();
|
||||
// }
|
||||
// return Response.ok(Status.NOT_FOUND).build();
|
||||
|
||||
FeedSubscription sub = feedSubscriptionDAO.findById(getUser(),
|
||||
req.getId());
|
||||
if (sub != null) {
|
||||
taskGiver.add(sub.getFeed());
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
return Response.ok(Status.NOT_FOUND).build();
|
||||
return Response.ok("Disabled for now").build();
|
||||
}
|
||||
|
||||
@Path("/mark")
|
||||
|
||||
Reference in New Issue
Block a user