Beispiel #1
0
        return $response->withStatus(422)->withJson(["success" => false, "message" => "Atleast one (1) data to update.", "error" => 1]);
    }
    $updateResult = CV::updateCV($uploadId, $data, $type);
    return $response->withStatus(200)->withJson($updateResult);
});
$app->post('/cv/{id}', function ($request, $response, $args) {
    $postParams = $request->getParsedBody();
    $uploadId = $args['id'];
    $data = [];
    if (isset($postParams["jobseekerId"])) {
        $data["jobseeker_id"] = $postParams["jobseekerId"];
    }
    if (!isset($data["jobseeker_id"])) {
        return $response->withStatus(422)->withJson(["success" => false, "message" => "Please specify jobseekerId.", "error" => 1]);
    }
    $updateResult = CV::updateCV($uploadId, $data);
    return $response->withStatus(200)->withJson($updateResult);
});
$app->get('/cv/download/original/byJobseekerId/{jobseekerId}', function ($request, $response, $args) {
    if (!isset($args["jobseekerId"])) {
        return $response->withStatus(422)->withJson(["success" => false, "message" => "jobseekerId is not found on path.", "error" => 1]);
    }
    $jobseekerId = $args["jobseekerId"];
    $getResult = CV::getOriginalFilePathByJobseekerId(["jobseeker_id" => $jobseekerId]);
    if ($getResult["success"]) {
        return $response->withStatus(200)->withHeader("Content-Length", $getResult["size"])->withHeader("Content-type", $getResult["mime"])->withHeader("Content-Disposition", 'attachment; filename="' . $getResult["name"] . '"')->withHeader("Content-Transfer-Encoding", "binary")->withHeader("Expires", "0")->withHeader("Cache-Control", "must-revalidate")->withHeader("Pragma", "public")->write($getResult["content"]);
    } else {
        return $response->withStatus(404)->withJson($getResult);
    }
});
$app->get('/cv/download/original/byUploadId/{uploadId}', function ($request, $response, $args) {