aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/entry.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/entry.go')
-rw-r--r--api/entry.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/api/entry.go b/api/entry.go
index 3b948f6..f0a0f99 100644
--- a/api/entry.go
+++ b/api/entry.go
@@ -164,7 +164,7 @@ func (h *handler) getEntries(w http.ResponseWriter, r *http.Request) {
func (h *handler) setEntryStatus(w http.ResponseWriter, r *http.Request) {
entryIDs, status, err := decodeEntryStatusPayload(r.Body)
if err != nil {
- json.BadRequest(w , r, errors.New("Invalid JSON payload"))
+ json.BadRequest(w, r, errors.New("Invalid JSON payload"))
return
}
@@ -193,25 +193,30 @@ func (h *handler) toggleBookmark(w http.ResponseWriter, r *http.Request) {
func configureFilters(builder *storage.EntryQueryBuilder, r *http.Request) {
beforeEntryID := request.QueryInt64Param(r, "before_entry_id", 0)
- if beforeEntryID != 0 {
+ if beforeEntryID > 0 {
builder.BeforeEntryID(beforeEntryID)
}
afterEntryID := request.QueryInt64Param(r, "after_entry_id", 0)
- if afterEntryID != 0 {
+ if afterEntryID > 0 {
builder.AfterEntryID(afterEntryID)
}
beforeTimestamp := request.QueryInt64Param(r, "before", 0)
- if beforeTimestamp != 0 {
+ if beforeTimestamp > 0 {
builder.BeforeDate(time.Unix(beforeTimestamp, 0))
}
afterTimestamp := request.QueryInt64Param(r, "after", 0)
- if afterTimestamp != 0 {
+ if afterTimestamp > 0 {
builder.AfterDate(time.Unix(afterTimestamp, 0))
}
+ categoryID := request.QueryInt64Param(r, "category_id", 0)
+ if categoryID > 0 {
+ builder.WithCategoryID(categoryID)
+ }
+
if request.HasQueryParam(r, "starred") {
builder.WithStarred()
}