From 5d08a44965715c89a6e828e9fd3f6d2a6449cb0f Mon Sep 17 00:00:00 2001 From: Stepan Date: Thu, 13 Nov 2025 12:05:08 +0100 Subject: [PATCH] fixed bugs --- app/Http/Controllers/AuthController.php | 6 +++--- app/Http/Controllers/CategoryController.php | 1 - app/Http/Resources/TestResource.php | 2 ++ storage/api-docs/api-docs.json | 17 ++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index adba8ff..9644cdf 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -311,7 +311,7 @@ class AuthController extends Controller } /** * @OA\Post( - * path="/api/auth/confirmation-account", + * path="/api/auth/activate-account", * summary="Confirm user account via email verification token", * tags={"Auth"}, * @OA\RequestBody( @@ -329,7 +329,7 @@ class AuthController extends Controller * ) * ), * @OA\Response( - * response=401, + * response=404, * description="Invalid token", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Your token is not valid") @@ -356,7 +356,7 @@ class AuthController extends Controller ]); $token = Token::existsTokenByToken($fields['token'], 'email_verification'); if(!$token) { - return response()->json(['message' => 'Your token is not valid'], 401); + return response()->json(['message' => 'Your token is not valid'], 404); } $user = $token->user; $token->delete(); diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 8250750..6e4e145 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -14,7 +14,6 @@ class CategoryController extends Controller * path="/api/categories", * summary="Get all categories", * tags={"Categories"}, - * security={{"bearerAuth": {}}}, * @OA\Response( * response=200, * description="List of categories", diff --git a/app/Http/Resources/TestResource.php b/app/Http/Resources/TestResource.php index 9c46bd3..a5c69fb 100644 --- a/app/Http/Resources/TestResource.php +++ b/app/Http/Resources/TestResource.php @@ -26,6 +26,7 @@ class TestResource extends JsonResource * @OA\Items(ref="#/components/schemas/QuestionResource") * ), * + * @OA\Property(property="is_available", type="boolean", example=true), * @OA\Property(property="author_id", type="integer", nullable=true, example=2), * @OA\Property(property="author", ref="#/components/schemas/UserResource"), * @@ -46,6 +47,7 @@ class TestResource extends JsonResource 'questions' => QuestionResource::collection($this->whenLoaded('questions')), + 'is_available' => $this->isAvailable(), 'author_id' => $this->author_id, 'author' => new UserResource($this->whenLoaded('author')), diff --git a/storage/api-docs/api-docs.json b/storage/api-docs/api-docs.json index d0757a2..3be46e8 100644 --- a/storage/api-docs/api-docs.json +++ b/storage/api-docs/api-docs.json @@ -427,13 +427,13 @@ } } }, - "/api/auth/confirmation-account": { + "/api/auth/activate-account": { "post": { "tags": [ "Auth" ], "summary": "Confirm user account via email verification token", - "operationId": "c8ecdf6fd50dc4c70fcc5bf19233e462", + "operationId": "cc3ffe1c1268e54e33a68adc9731e7d3", "requestBody": { "required": true, "content": { @@ -470,7 +470,7 @@ } } }, - "401": { + "404": { "description": "Invalid token", "content": { "application/json": { @@ -568,12 +568,7 @@ } } } - }, - "security": [ - { - "bearerAuth": [] - } - ] + } }, "post": { "tags": [ @@ -2765,6 +2760,10 @@ "$ref": "#/components/schemas/QuestionResource" } }, + "is_available": { + "type": "boolean", + "example": true + }, "author_id": { "type": "integer", "example": 2,