Beispiel #1
0
        return $response->withStatus(200)->write(serialize($uploader->getResult()));
    } else {
        return $response->withStatus(422)->write(serialize($uploader->getResult()));
    }
});
$app->get('/cv/byUploadId/{type}/{id}[/{dataType}]', function ($request, $response, $args) {
    $type = strtoupper($args['type']);
    $id = $args['id'];
    $dataType = strtoupper(isset($args['dataType']) ? $args['dataType'] : 'serialize');
    return CV::getData($type, ["upload_id" => $id], $dataType, $response);
});
$app->get('/cv/byJobseekerId/{type}/{jobseekerId}[/{dataType}]', function ($request, $response, $args) {
    $type = strtoupper($args['type']);
    $jobseekerId = $args['jobseekerId'];
    $dataType = strtoupper(isset($args['dataType']) ? $args['dataType'] : 'serialize');
    return CV::getData($type, ["jobseeker_id" => $jobseekerId], $dataType, $response);
});
$app->post('/cv/{type}/{id}', function ($request, $response, $args) {
    $postParams = $request->getParsedBody();
    $type = strtoupper($args['type']);
    $uploadId = $args['id'];
    $data = [];
    if (isset($postParams["jobseekerId"])) {
        $data["jobseeker_id"] = $postParams["jobseekerId"];
    }
    if (isset($postParams["updated"])) {
        $data["updated"] = $postParams["updated"];
    }
    if (!isset($data["jobseeker_id"]) && !isset($data["updated"])) {
        return $response->withStatus(422)->withJson(["success" => false, "message" => "Atleast one (1) data to update.", "error" => 1]);
    }