juggl/juggl-server/getRecord.php
2020-11-06 21:04:45 +01:00

34 lines
850 B
PHP

<?php
session_start();
require_once(__DIR__ . "/services/apiBranch.inc.php");
require_once(__DIR__ . "/services/jsonBuilder.inc.php");
require_once(__DIR__ . "/services/responses.inc.php");
require_once(__DIR__ . "/services/jugglDbApi.inc.php");
class GetRecordBranch extends ApiBranch
{
function get(ParamCleaner $params)
{
respondStatus(405);
}
function post(ParamCleaner $params)
{
$user_id = $params->get("user_id");
$params->select("request");
if ($params->exists(["record_id"]) == false) {
respondStatus(400, "Missing parameter");
}
$record = getTimeRecord($user_id, $params->get("record_id"));
$json = new JsonBuilder();
$json->addRecords([$record]);
respondJson($json);
}
}
$branch = new GetRecordBranch();
$branch->execute();