File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/NupdecActuationsController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Requests\NupdecActuationRequest; use App\Http\Services\NupdecActuationService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; class NupdecActuationsController extends Controller { private NupdecActuationService $service; public function __construct() { $this->service = new NupdecActuationService(); } /** * @OA\Get( * path="/api/nupdec/actuations", * summary="Get all donation nupdec actuations", * operationId="GetAllNupdecActuations", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ) * ) */ public function index(): JsonResponse { $response = $this->service->index(); return response()->json($response->data, $response->code); } /** * @OA\Post( * path="/api/nupdec/actuations", * summary="Add a new nupdec actuation", * operationId="AddNewNupdecActuation", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"nupdec_id", "date"}, * @OA\Property( * property="nupdec_id", * type="string" * ), * @OA\Property( * property="date", * type="string" * ), * @OA\Property( * property="notes", * type="string" * ), * ) * ) * ), * @OA\Response( * response="201", * description="CREATED", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="400", * description="Bad Request", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Bad Request."), * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ) * ) */ public function store(NupdecActuationRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/nupdec/actuations/{id}", * summary="Get details from a nupdec actuation", * operationId="GetNupdecActuationDetails", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Actuation ID", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Nupdec Actuation not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Actuation not found") * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ) * ) */ public function show(string $id): JsonResponse { $response = $this->service->show($id); return response()->json($response->data, $response->code); } /** * @OA\Put( * path="/api/nupdec/actuations/{id}", * summary="Update a nupdec actuation", * operationId="UpdateNupdecActuation", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Actuation ID", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * @OA\Property( * property="nupdec_id", * type="string" * ), * @OA\Property( * property="date", * type="string" * ), * @OA\Property( * property="notes", * type="string" * ), * ) * ) * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Nupdec Actuation not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Actuation not found") * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * ) */ public function update(Request $request, string $id): JsonResponse { $response = $this->service->update($request, $id); return response()->json($response->data, $response->code); } /** * @OA\Delete( * path="/api/nupdec/actuations/{id}", * summary="Delete a nupdec actuation", * operationId="DeleteNupdecActuation", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Actuation ID", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Nupdec Actuation not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Actuation not found") * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * ) */ public function destroy(string $id): JsonResponse { $response = $this->service->delete($id); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/nupdec/actuations-by-nupdec/{nupdec_id}", * summary="Get all donation nupdec actuations", * operationId="GetAllNupdecActuationsByNupdec", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\Parameter( * name="nupdec_id", * in="path", * required=true, * description="Nupdec ID", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * ) */ public function getByNupdec(string $nupdecId): JsonResponse { $response = $this->service->getByNupdec($nupdecId); return response()->json($response->data, $response->code); } /** * @OA\Post( * path="/api/nupdec/actuation/store-many", * summary="Adiciona várias actuações de um nupdec", * operationId="AddNewNupdecActuations", * security={{"bearerAuth":{}}}, * tags={"Nupdec Actuations"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"nupdec_id", "actuations"}, * @OA\Property( * property="nupdec_id", * type="string" * ), * @OA\Property( * property="actuations", * type="array", * collectionFormat="multi", * @OA\Items( * @OA\Property( * property="notes", * type="string", * ), * @OA\Property( * property="date", * type="string", * ), * ), * ), * ) * ) * ), * @OA\Response( * response="201", * description="CREATED", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="400", * description="Bad Request", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Bad Request."), * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * @OA\Response( * response="404", * description="Nupdec not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec not found."), * ) * ), * ) */ public function storeMany(Request $request): JsonResponse { $response = $this->service->storeMany($request); return response()->json($response->data, $response->code); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings