Updated the task view and backend to handle more like a routine
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// POST /api/tasks/update — Modify a task
|
||||
// Body: {"id":1, "title":"...", "due_date":..., "completed":true}
|
||||
// All fields except "id" are optional
|
||||
// Body: {"id":1, "title":"...", "due_date":..., "period":0, "recurrence":0,
|
||||
// "completed":true} All fields except "id" are optional
|
||||
|
||||
#include "cJSON.h"
|
||||
#include "esp_http_server.h"
|
||||
@@ -58,6 +58,18 @@ internal esp_err_t api_tasks_update_handler(httpd_req_t *req)
|
||||
task->due_date = (int64)due_date_item->valuedouble;
|
||||
}
|
||||
|
||||
cJSON *period_item = cJSON_GetObjectItem(body, "period");
|
||||
if (cJSON_IsNumber(period_item))
|
||||
{
|
||||
task->period = (uint8)period_item->valueint;
|
||||
}
|
||||
|
||||
cJSON *recurrence_item = cJSON_GetObjectItem(body, "recurrence");
|
||||
if (cJSON_IsNumber(recurrence_item))
|
||||
{
|
||||
task->recurrence = (uint8)recurrence_item->valueint;
|
||||
}
|
||||
|
||||
cJSON *completed_item = cJSON_GetObjectItem(body, "completed");
|
||||
if (cJSON_IsBool(completed_item))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user