correct api definition errors

This commit is contained in:
Paul Liverman III 2018-03-16 17:15:38 -07:00
parent b2a31cc045
commit aa98c4c478

View File

@ -34,8 +34,7 @@ get_task = =>
class extends Application
-- api_key AND text
[new: "/new"]: capture_errors_json =>
json_params =>
[new: "/new"]: capture_errors_json json_params =>
key = get_key(@)
yield_error "Task text not specified." unless @params.text and @params.text\len! > 0
@ -47,8 +46,7 @@ class extends Application
return json: { success: true, :task }
-- api_key AND id
[do: "/do"]: capture_errors_json =>
json_params =>
[do: "/do"]: capture_errors_json json_params =>
if task = get_task(@)
task = assert_error task\update { done: true }
return json: { success: true, :task }
@ -56,8 +54,7 @@ class extends Application
return standard_err!
-- api_key AND id
[undo: "/undo"]: capture_errors_json =>
json_params =>
[undo: "/undo"]: capture_errors_json json_params =>
if task = get_task(@)
task = assert_error task\update { done: false }
return json: { success: true, :task }
@ -65,8 +62,7 @@ class extends Application
return standard_err!
-- api_key AND (id OR (done true/false/nil AND/OR page))
[fetch: "/fetch"]: capture_errors_json =>
json_params =>
[fetch: "/fetch"]: capture_errors_json json_params =>
if @params.id
if task = get_task(@)
return json: { success: true, :task }
@ -86,8 +82,7 @@ class extends Application
return json: { success: true, :tasks }
-- api_key AND done true/false/nil
[random: "/fetch/random"]: capture_errors_json =>
json_params =>
[random: "/fetch/random"]: capture_errors_json json_params =>
key = get_key(@)
local tasks
@ -104,8 +99,7 @@ class extends Application
return standard_err!
-- api_key AND done true/false/nil AND/OR case true
[search: "/search"]: capture_errors_json =>
json_params =>
[search: "/search"]: capture_errors_json json_params =>
key = get_key(@)
like = @params.case and "ILIKE" or "LIKE"