mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
initial starring support
This commit is contained in:
@@ -42,12 +42,13 @@ import com.wordnik.swagger.annotations.ApiParam;
|
||||
public class CategoryREST extends AbstractResourceREST {
|
||||
|
||||
public static final String ALL = "all";
|
||||
public static final String STARRED = "starred";
|
||||
|
||||
@Path("/entries")
|
||||
@GET
|
||||
@ApiOperation(value = "Get category entries", notes = "Get a list of category entries", responseClass = "com.commafeed.frontend.model.Entries")
|
||||
public Entries getCategoryEntries(
|
||||
@ApiParam(value = "id of the category, or 'all'", required = true) @QueryParam("id") String id,
|
||||
@ApiParam(value = "id of the category, 'all' or 'starred'", required = true) @QueryParam("id") String id,
|
||||
@ApiParam(value = "all entries or only unread ones", allowableValues = "all,unread", required = true) @QueryParam("readType") ReadType readType,
|
||||
@ApiParam(value = "offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
|
||||
@ApiParam(value = "limit for paging") @DefaultValue("-1") @QueryParam("limit") int limit,
|
||||
@@ -67,6 +68,13 @@ public class CategoryREST extends AbstractResourceREST {
|
||||
entries.getEntries().add(Entry.build(status));
|
||||
}
|
||||
|
||||
} else if (STARRED.equals(id)) {
|
||||
entries.setName("Starred");
|
||||
List<FeedEntryStatus> starred = feedEntryStatusDAO.findStarred(
|
||||
getUser(), offset, limit, order, true);
|
||||
for (FeedEntryStatus status : starred) {
|
||||
entries.getEntries().add(Entry.build(status));
|
||||
}
|
||||
} else {
|
||||
FeedCategory feedCategory = feedCategoryDAO.findById(getUser(),
|
||||
Long.valueOf(id));
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.commafeed.backend.model.FeedEntryStatus;
|
||||
import com.commafeed.frontend.model.Entries;
|
||||
import com.commafeed.frontend.model.Entry;
|
||||
import com.commafeed.frontend.model.request.MarkRequest;
|
||||
import com.commafeed.frontend.model.request.StarRequest;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
@@ -40,6 +41,20 @@ public class EntryREST extends AbstractResourceREST {
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@Path("/star")
|
||||
@POST
|
||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
||||
public Response starFeedEntry(
|
||||
@ApiParam(value = "Star Request", required = true) StarRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
|
||||
feedEntryService.starEntry(getUser(), Long.valueOf(req.getId()),
|
||||
req.isStarred());
|
||||
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@Path("/search")
|
||||
@GET
|
||||
@ApiOperation(value = "Search for entries", notes = "Look through title and content of entries by keywords", responseClass = "com.commafeed.frontend.model.Entries")
|
||||
|
||||
Reference in New Issue
Block a user