get("user_id"); if ($params->exists(["start_time"]) == false) { respondStatus(400, "Missing parameter"); } $project_id = $params->get("project_id"); if (isProjectValid($project_id, $user_id) == false) { $project_id = null; } $device_id = $params->get("start_device_id"); if (isDeviceValid($device_id, $user_id) == false) { $device_id = null; } // Does a running record for that project already exist? if (getProjectRecord($user_id, $project_id, false) != null) { respondStatus(409, "Project record already started"); } addStartRecord($user_id, $params, $project_id, $device_id); $record = getProjectRecord($user_id, $project_id, false); $json = new JsonBuilder(); $json->addRecords([$record]); respondJson($json); } } $branch = new StartRecordBranch(); $branch->execute();