Updated the task view and backend to handle more like a routine

This commit is contained in:
2026-03-08 22:10:46 -04:00
parent 4161ff9513
commit 9d3a277f45
14 changed files with 405 additions and 147 deletions

View File

@@ -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))
{