fixed bugs

This commit is contained in:
Stepan 2025-11-13 12:05:08 +01:00
parent 4e30af1841
commit 5d08a44965
4 changed files with 13 additions and 13 deletions

View File

@ -311,7 +311,7 @@ class AuthController extends Controller
} }
/** /**
* @OA\Post( * @OA\Post(
* path="/api/auth/confirmation-account", * path="/api/auth/activate-account",
* summary="Confirm user account via email verification token", * summary="Confirm user account via email verification token",
* tags={"Auth"}, * tags={"Auth"},
* @OA\RequestBody( * @OA\RequestBody(
@ -329,7 +329,7 @@ class AuthController extends Controller
* ) * )
* ), * ),
* @OA\Response( * @OA\Response(
* response=401, * response=404,
* description="Invalid token", * description="Invalid token",
* @OA\JsonContent( * @OA\JsonContent(
* @OA\Property(property="message", type="string", example="Your token is not valid") * @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'); $token = Token::existsTokenByToken($fields['token'], 'email_verification');
if(!$token) { 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; $user = $token->user;
$token->delete(); $token->delete();

View File

@ -14,7 +14,6 @@ class CategoryController extends Controller
* path="/api/categories", * path="/api/categories",
* summary="Get all categories", * summary="Get all categories",
* tags={"Categories"}, * tags={"Categories"},
* security={{"bearerAuth": {}}},
* @OA\Response( * @OA\Response(
* response=200, * response=200,
* description="List of categories", * description="List of categories",

View File

@ -26,6 +26,7 @@ class TestResource extends JsonResource
* @OA\Items(ref="#/components/schemas/QuestionResource") * @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_id", type="integer", nullable=true, example=2),
* @OA\Property(property="author", ref="#/components/schemas/UserResource"), * @OA\Property(property="author", ref="#/components/schemas/UserResource"),
* *
@ -46,6 +47,7 @@ class TestResource extends JsonResource
'questions' => QuestionResource::collection($this->whenLoaded('questions')), 'questions' => QuestionResource::collection($this->whenLoaded('questions')),
'is_available' => $this->isAvailable(),
'author_id' => $this->author_id, 'author_id' => $this->author_id,
'author' => new UserResource($this->whenLoaded('author')), 'author' => new UserResource($this->whenLoaded('author')),

View File

@ -427,13 +427,13 @@
} }
} }
}, },
"/api/auth/confirmation-account": { "/api/auth/activate-account": {
"post": { "post": {
"tags": [ "tags": [
"Auth" "Auth"
], ],
"summary": "Confirm user account via email verification token", "summary": "Confirm user account via email verification token",
"operationId": "c8ecdf6fd50dc4c70fcc5bf19233e462", "operationId": "cc3ffe1c1268e54e33a68adc9731e7d3",
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@ -470,7 +470,7 @@
} }
} }
}, },
"401": { "404": {
"description": "Invalid token", "description": "Invalid token",
"content": { "content": {
"application/json": { "application/json": {
@ -568,12 +568,7 @@
} }
} }
} }
}, }
"security": [
{
"bearerAuth": []
}
]
}, },
"post": { "post": {
"tags": [ "tags": [
@ -2765,6 +2760,10 @@
"$ref": "#/components/schemas/QuestionResource" "$ref": "#/components/schemas/QuestionResource"
} }
}, },
"is_available": {
"type": "boolean",
"example": true
},
"author_id": { "author_id": {
"type": "integer", "type": "integer",
"example": 2, "example": 2,