src/Controller/API/CarpetaCiudadanaController.php line 51

Open in your IDE?
  1. <?php
  2. namespace App\Controller\API;
  3. use App\Controller\BaseController;
  4. use App\Entity\Log\LogInteraction;
  5. use App\Services\API\CarpetaCiudadanaService;
  6. use App\Utils\APIResponse;
  7. use App\Utils\CommonFunctions;
  8. use Exception;
  9. use OpenApi\Annotations as OA;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. /**
  14.  * @Route("/CarpetaCiudadana")
  15.  */
  16. class CarpetaCiudadanaController extends BaseController
  17. {
  18.     /**
  19.      * @Route("/validaNivel", name="valida-nivel", methods={"POST"})
  20.      * @param Request $request
  21.      * @param CarpetaCiudadanaService $CarpetaCiudadanaService
  22.      * @return Response
  23.      *
  24.      * @OA\Post (
  25.      *     path="/api/v1/CarpetaCiudadana/validaNivel",
  26.      *     summary="Valicacion del nivel de miba",
  27.      *     @OA\RequestBody(
  28.      *         @OA\MediaType(
  29.      *             mediaType="application/json",
  30.      *             @OA\Schema(
  31.      *                 @OA\Property(property="nivel", type="string"),
  32.      *             )
  33.      *         )
  34.      *     ),
  35.      *     @OA\Response(
  36.      *         response=200,
  37.      *         description="Response",
  38.      *         @OA\MediaType(
  39.      *             mediaType="application/json",
  40.      *             @OA\Schema(
  41.      *                 @OA\Property(property="status", type="integer"),
  42.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  43.      *                 @OA\Property(property="content", type="object")
  44.      *            )
  45.      *        )
  46.      *    )
  47.      * )
  48.      */
  49.     public function validaNivel(Request $requestCarpetaCiudadanaService $CarpetaCiudadanaService)
  50.     {
  51.         $statusCode APIResponse::$SUCCESS;
  52.         $status APIResponse::$SUCCESS;
  53.         $errors = array();
  54.         $result null;
  55.         try {
  56.             $data CommonFunctions::getValidJson($request->getContent());
  57.             $result $CarpetaCiudadanaService->validarNivel($data);
  58.         } catch (Exception $e) {
  59.             $statusCode APIResponse::$INTERNAL_ERROR;
  60.             $status APIResponse::$INTERNAL_ERROR;
  61.             $errors = array($e->getMessage());
  62.             $errorInfo CommonFunctions::getErrorException($e);
  63.             $this->logInteractionService->addErrorLog(
  64.                 LogInteraction::$LIST,
  65.                 CommonFunctions::getClassMethod(__METHOD__),
  66.                 $e->getMessage(),
  67.                 $errorInfo
  68.             );
  69.         }
  70.         return $this->generateJsonResponse($result$statusCode$status$errors);
  71.     }
  72.     /**
  73.      * @Route("/documentos", name="documentos", methods={"POST"})
  74.      * @param Request $request
  75.      * @param CarpetaCiudadanaService $CarpetaCiudadanaService
  76.      * @return Response
  77.      *
  78.      * @OA\Post (
  79.      *     path="/api/v1/CarpetaCiudadana/documentos",
  80.      *     summary="Obtener los documento asociados al ciudadano",
  81.      *     @OA\RequestBody(
  82.      *         @OA\MediaType(
  83.      *             mediaType="application/json",
  84.      *             @OA\Schema(
  85.      *                 @OA\Property(property="mibaId", type="string"),
  86.      *                 @OA\Property(property="orden", type="string"),
  87.      *                 @OA\Property(property="tipoOrden", type="string"),
  88.      *                 @OA\Property(property="page", type="integer"),
  89.      *             )
  90.      *         )
  91.      *     ),
  92.      *     @OA\Response(
  93.      *         response=200,
  94.      *         description="Response",
  95.      *         @OA\MediaType(
  96.      *             mediaType="application/json",
  97.      *             @OA\Schema(
  98.      *                 @OA\Property(property="status", type="integer"),
  99.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  100.      *                 @OA\Property(property="content", type="object")
  101.      *            )
  102.      *        )
  103.      *    )
  104.      * )
  105.      */
  106.     public function getDocumentosAction(Request $requestCarpetaCiudadanaService $CarpetaCiudadanaService)
  107.     {
  108.         $statusCode APIResponse::$SUCCESS;
  109.         $status APIResponse::$SUCCESS;
  110.         $errors = array();
  111.         $result null;
  112.         try {
  113.             $data CommonFunctions::getValidJson($request->getContent());
  114.             $result $CarpetaCiudadanaService->getDocumentos($data);
  115.         } catch (Exception $e) {
  116.             $statusCode APIResponse::$INTERNAL_ERROR;
  117.             $status APIResponse::$INTERNAL_ERROR;
  118.             $errors = array($e->getMessage());
  119.             $errorInfo CommonFunctions::getErrorException($e);
  120.             $this->logInteractionService->addErrorLog(
  121.                 LogInteraction::$LIST,
  122.                 CommonFunctions::getClassMethod(__METHOD__),
  123.                 $e->getMessage(),
  124.                 $errorInfo
  125.             );
  126.         }
  127.         return $this->generateJsonResponse($result$statusCode$status$errors);
  128.     }
  129.     /**
  130.      * @Route("/documentoDigital", name="documentoDigital", methods={"POST"})
  131.      * @param Request $request
  132.      * @param CarpetaCiudadanaService $CarpetaCiudadanaService
  133.      * @return Response
  134.      *
  135.      * @OA\Post (
  136.      *     path="/api/v1/CarpetaCiudadana/documentoDigital",
  137.      *     summary="Obtener los documento asociados al ciudadano",
  138.      *     @OA\RequestBody(
  139.      *         @OA\MediaType(
  140.      *             mediaType="application/json",
  141.      *             @OA\Schema(
  142.      *                 @OA\Property(property="url", type="string"),
  143.      *             )
  144.      *         )
  145.      *     ),
  146.      *     @OA\Response(
  147.      *         response=200,
  148.      *         description="Response",
  149.      *         @OA\MediaType(
  150.      *             mediaType="application/json",
  151.      *             @OA\Schema(
  152.      *                 @OA\Property(property="status", type="integer"),
  153.      *                 @OA\Property(property="errors", type="array", @OA\Items(type="string")),
  154.      *                 @OA\Property(property="content", type="object")
  155.      *            )
  156.      *        )
  157.      *    )
  158.      * )
  159.      */
  160.     public function getDocumentoDigitalAction(Request $requestCarpetaCiudadanaService $CarpetaCiudadanaService)
  161.     {
  162.         $statusCode APIResponse::$SUCCESS;
  163.         $status APIResponse::$SUCCESS;
  164.         $errors = array();
  165.         $result null;
  166.         try {
  167.             $data CommonFunctions::getValidJson($request->getContent());
  168.             $result $CarpetaCiudadanaService->getDocumentoDigital($data);
  169.         } catch (Exception $e) {
  170.             $statusCode APIResponse::$INTERNAL_ERROR;
  171.             $status APIResponse::$INTERNAL_ERROR;
  172.             $errors = array($e->getMessage());
  173.             $errorInfo CommonFunctions::getErrorException($e);
  174.             $this->logInteractionService->addErrorLog(
  175.                 LogInteraction::$LIST,
  176.                 CommonFunctions::getClassMethod(__METHOD__),
  177.                 $e->getMessage(),
  178.                 $errorInfo
  179.             );
  180.         }
  181.         return $this->generateJsonResponse($result$statusCode$status$errors);
  182.     }
  183. }