File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/NupdecActivitiesController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Requests\NupdecActivityRequest; use App\Http\Services\NupdecActivityService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; class NupdecActivitiesController extends Controller { private NupdecActivityService $service; public function __construct() { $this->service = new NupdecActivityService(); } /** * @OA\Get( * path="/api/nupdec/activities", * summary="Get all donation nupdec activities", * operationId="GetAllNupdecActivities", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @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/activities", * summary="Add a new nupdec activity", * operationId="AddNewNupdecActivity", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @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(NupdecActivityRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/nupdec/activities/{id}", * summary="Get details from a nupdec activity", * operationId="GetNupdecActivityDetails", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Activity 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 Activity not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Activity 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/activities/{id}", * summary="Update a nupdec activity", * operationId="UpdateNupdecActivity", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Activity 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 Activity not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Activity 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/activities/{id}", * summary="Delete a nupdec activity", * operationId="DeleteNupdecActivity", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="Nupdec Activity 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 Activity not found", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Nupdec Activity 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/activities-by-nupdec/{nupdec_id}", * summary="Get all donation nupdec activities", * operationId="GetAllNupdecActivitiesByNupdec", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @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/activity/store-many", * summary="Adiciona várias actuações de um nupdec", * operationId="AddNewNupdecActivities", * security={{"bearerAuth":{}}}, * tags={"Nupdec Activities"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"nupdec_id", "activities"}, * @OA\Property( * property="nupdec_id", * type="string" * ), * @OA\Property( * property="activities", * 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