diff --git a/app/Annotations/OpenApi/AnnotationsInfo.php b/app/Annotations/OpenApi/AnnotationsInfo.php index 7fbf3d42..1bbaf44f 100644 --- a/app/Annotations/OpenApi/AnnotationsInfo.php +++ b/app/Annotations/OpenApi/AnnotationsInfo.php @@ -8,12 +8,14 @@ * title="ITA Profiles page API documentation", * description="Documentation needed for the API Rest for the ITA Profiles page to IT Academy. Some useful links below: * [ITA Profles Backend](https://github.com/IT-Academy-BCN/ita-profiles-backend) - * [ITA Profiles Frontend](https://github.com/IT-Academy-BCN/ita-profiles-frontend) - * To use the endpoints, prefix them with '**api/v1**'. For example: '**POST: https://itaperfils.eurecatacademy.org/api/v1/students'**'." + * [ITA Profiles Frontend](https://github.com/IT-Academy-BCN/ita-profiles-frontend)" * ) * * @OA\Server( * url="http://127.0.0.1:8000" + * ) + * @OA\Server( * url="http://127.0.0.1:8000/api/v1" + * ) */ class AnnotationsInfo {} diff --git a/app/Annotations/OpenApi/controllersAnnotations/tagAnnotations/AnnotationsTag.php b/app/Annotations/OpenApi/controllersAnnotations/tagAnnotations/AnnotationsTag.php index 4decec85..2cdf8439 100644 --- a/app/Annotations/OpenApi/controllersAnnotations/tagAnnotations/AnnotationsTag.php +++ b/app/Annotations/OpenApi/controllersAnnotations/tagAnnotations/AnnotationsTag.php @@ -40,7 +40,7 @@ class AnnotationsTag * @OA\Property(property="status", type="boolean", example=false), * @OA\Property(property="message", type="string", example="Unauthorized") * ) - * ) + * ), * @OA\Response( * response=404, * description="No tags found.", @@ -61,19 +61,18 @@ public function index() {} * tags={"Tags"}, * summary="Create a new tag", * description="Creates a new tag. Admin Authentication is required.", - * * security={{"bearer": {}}}, - * required=true, - * - * @OA\JsonContent( * + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * type="object", * @OA\Property(property="id", type="integer", example=1), * @OA\Property(property="tag_name", type="string", example="Laravel"), * @OA\Property(property="created_at", type="string", format="date-time", example="2024-01-25T12:34:56Z"), * @OA\Property(property="updated_at", type="string", format="date-time", example="2024-01-25T12:34:56Z"), - * ) + * ) * ), - * * @OA\Response( * response=201, * description="Tag created successfully.", @@ -104,6 +103,7 @@ public function store() {} * description="Retrieve details of a specific tag based on the provided ID. Admin Authentication is required.", * * security={{"bearer": {}}}, + * @OA\Parameter( * name="id", * in="path", * required=true, @@ -116,10 +116,9 @@ public function store() {} * description="Tag details retrieved successfully.", * * @OA\JsonContent( - * type="array", * - * @OA\Items( - * type="object", + * type="object", + * * @OA\Property( * property="data", * type="object", @@ -138,7 +137,7 @@ public function store() {} * @OA\Property(property="message", type="string", example="Tag not found."), * ), * ), - * ) + * ) */ public function show() {} @@ -149,8 +148,9 @@ public function show() {} * tags={"Tags"}, * summary="Update details of a specific tag.", * description="Updates details of a specific tag based on the provided ID. Admin Authentication is required.", - * * security={{"bearer": {}}}, + * @OA\Parameter( + * name="id", * in="path", * required=true, @@ -203,8 +203,8 @@ public function update() {} * tags={"Tags"}, * summary="Delete a specific tag.", * description="Deletes a specific tag based on the provided ID. Admin Authentication is required.", - * * security={{"bearer": {}}}, + * @OA\Parameter( * name="id", * in="path", * required=true, diff --git a/storage/api-docs/api-docs.json b/storage/api-docs/api-docs.json index de8577b2..3983845e 100644 --- a/storage/api-docs/api-docs.json +++ b/storage/api-docs/api-docs.json @@ -2,12 +2,15 @@ "openapi": "3.0.0", "info": { "title": "ITA Profiles page API documentation", - "description": "Documentation needed for the API Rest for the ITA Profiles page to IT Academy. Some useful links below:\n * [ITA Profles Backend](https://github.com/IT-Academy-BCN/ita-profiles-backend)\n * [ITA Profiles Frontend](https://github.com/IT-Academy-BCN/ita-profiles-frontend)\n * To use the endpoints, prefix them with '**api/v1**'. For example: '**POST: https://itaperfils.eurecatacademy.org/api/v1/students'**'.", + "description": "Documentation needed for the API Rest for the ITA Profiles page to IT Academy. Some useful links below:\n * [ITA Profles Backend](https://github.com/IT-Academy-BCN/ita-profiles-backend)\n * [ITA Profiles Frontend](https://github.com/IT-Academy-BCN/ita-profiles-frontend)", "version": "1.0.0" }, "servers": [ { "url": "http://127.0.0.1:8000" + }, + { + "url": "http://127.0.0.1:8000/api/v1" } ], "paths": { @@ -1442,6 +1445,26 @@ } } }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "Unauthorized" + } + }, + "type": "object" + } + } + } + }, "404": { "description": "No tags found.", "content": { @@ -1530,7 +1553,12 @@ } } } - } + }, + "security": [ + { + "bearer": [] + } + ] } }, "/tags/{id}": { @@ -1559,30 +1587,32 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "properties": { - "id": { - "type": "integer", - "example": 1 - }, - "tag_name": { - "type": "string", - "example": "Laravel" - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2024-01-25T12:34:56Z" + "properties": { + "data": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "tag_name": { + "type": "string", + "example": "Laravel" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2024-01-25T12:34:56Z" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2024-01-25T12:34:56Z" + } }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2024-01-25T12:34:56Z" - } - }, - "type": "object" - } + "type": "object" + } + }, + "type": "object" } } } @@ -1603,7 +1633,12 @@ } } } - } + }, + "security": [ + { + "bearer": [] + } + ] }, "put": { "tags": [ @@ -1694,7 +1729,12 @@ } } } - } + }, + "security": [ + { + "bearer": [] + } + ] }, "delete": { "tags": [ @@ -1748,7 +1788,12 @@ } } } - } + }, + "security": [ + { + "bearer": [] + } + ] } } }, @@ -1967,4 +2012,4 @@ } } } -} +} \ No newline at end of file