test openapi
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
@@ -27,6 +28,9 @@ class TeamController extends Controller
|
||||
return serializeApiResponse($team);
|
||||
}
|
||||
|
||||
#[OA\Get(path: '/teams')]
|
||||
#[OA\Response(response: '200', description: 'List of teams')]
|
||||
#[OA\Response(response: '401', description: 'Unauthorized')]
|
||||
public function teams(Request $request)
|
||||
{
|
||||
$teamId = getTeamIdFromToken();
|
||||
@@ -43,6 +47,33 @@ class TeamController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
#[OA\Get(path: '/teams/{id}')]
|
||||
#[OA\Response(
|
||||
response: 401,
|
||||
description: 'Unauthorized',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'message', type: 'string', example: 'Unauthenticated.'),
|
||||
]
|
||||
)
|
||||
)]
|
||||
#[OA\Response(response: '404', description: 'Team not found')]
|
||||
#[OA\Parameter(name: 'id', in: 'path', required: true, description: 'Team ID', schema: new OA\Schema(type: 'integer'))]
|
||||
// response 200 with team model
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Team model',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer', example: 1),
|
||||
new OA\Property(property: 'name', type: 'string', example: 'Team 1'),
|
||||
new OA\Property(property: 'created_at', type: 'string', format: 'date-time', example: '2021-10-10T10:00:00Z'),
|
||||
new OA\Property(property: 'updated_at', type: 'string', format: 'date-time', example: '2021-10-10T10:00:00Z'),
|
||||
]
|
||||
)
|
||||
)]
|
||||
public function team_by_id(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
|
||||
Reference in New Issue
Block a user