Skip to content

Commit d245abb

Browse files
committed
#3 update doc openapi + #10 custom configDataset
1 parent 8367f4d commit d245abb

16 files changed

+137
-32
lines changed

app/Command/InitCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
1414

1515
(new \Controller\api\InitApi())->getStructure();
1616
(new \Controller\api\InitApi())->getData();
17+
(new \Controller\api\InitApi())->copyConfig();
1718

1819
return Command::SUCCESS;
1920
}

app/Controller/api/InitApi.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,14 @@ public function getData(): array
7575
"message" => "API VELIKO is running"
7676
];
7777
}
78+
79+
public function copyConfig(): array
80+
{
81+
copy(__DIR__ . '/../../docker/configDataset.json', __DIR__ . '/../../var/configDataset.json');
82+
83+
return [
84+
"status" => "success",
85+
"message" => "API VELIKO is running"
86+
];
87+
}
7888
}

app/Controller/api/InitController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ class InitController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/init/data',
13-
operationId: 'initApiData',
14-
summary: 'initApiData',
15-
description: 'Initialisation de l\'API VELIKO se fait au dédut projet. Elle permet de récupérer les données des stations et des status des stations sur API officielle de VELIB',
13+
tags: ['Initialisation'],
14+
operationId: 'InitData',
15+
summary: 'init-data',
16+
description: 'Vous pouvez initialisation de l\'API VELIKO. Elle permet de récupérer les données des stations et des status des stations sur API officielle de VELIB',
1617
)]
1718
#[Attributes\Response(
1819
response: '200',
@@ -53,6 +54,7 @@ public function execute(Request $request): string|null
5354
header('Content-Type: application/json');
5455

5556
try {
57+
(new \Controller\api\InitApi())->copyConfig();
5658
$listTest = (new \Controller\api\InitApi())->getData();
5759
} catch (\Exception $e) {
5860
http_response_code(500);

app/Controller/api/SchemaController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ class SchemaController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/init/schema',
13-
operationId: 'initApiSchema',
14-
summary: 'initApiSchema',
15-
description: 'Initialisation de la scruture de la base de données de l\'API VELIKO se fait au dédut projet. Elle permet de créer les tables de la base de données',
13+
tags: ['Initialisation'],
14+
operationId: 'InitSchema',
15+
summary: 'init-schema',
16+
description: 'Vous pouvez initialisation de la scruture de la base de données de l\'API VELIKO. Elle permet de créer les tables de la base de données en cas de reset',
1617
)]
1718
#[Attributes\Response(
1819
response: '200',

app/Controller/api/Station/StationIdController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class StationIdController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/station/{id}',
13+
tags: ['station'],
1314
operationId: 'getStationById',
1415
description: 'Récupérer les informations d une station par son ID (station_id)<br>
1516
La description des champs:<br>

app/Controller/api/Station/StationStatusIdController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class StationStatusIdController implements ControllerInterface
1111
{
1212
#[Attributes\Get(
1313
path: '/api/station/{id}/status[/{optional}]',
14+
tags: ['station'],
1415
operationId: 'getStationStatusById',
1516
description: 'Récupérer le status d une station par son ID (station_id)<br>
1617
Statut d une station dans son état actuel, celle-ci à une timestamp de dernière mise à jour (last_reported).<br>

app/Controller/api/Station/StationsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class StationsController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/stations',
13+
tags: ['station'],
1314
operationId: 'getStations',
1415
description: 'Récupérer une liste des informations des stations<br>
1516
La description des champs:<br>

app/Controller/api/Status/StationsStatusController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class StationsStatusController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/stations/status',
13+
tags: ['status', 'station'],
1314
operationId: 'getStationsStatus',
1415
summary: 'getStationsStatus',
1516
description: 'Liste des status des stations, voici la structure de données

app/Controller/api/Velo/VeloByIdController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class VeloByIdController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/velo/{id}',
13+
tags: ['velo'],
1314
operationId: 'getVeloById',
1415
summary: 'getVeloById',
1516
description: 'Information du vélos, voici la structure de données

app/Controller/api/Velo/VeloController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class VeloController implements ControllerInterface
1010
{
1111
#[Attributes\Get(
1212
path: '/api/velos',
13+
tags: ['velo'],
1314
operationId: 'getVelos',
1415
summary: 'getVelos',
1516
description: 'Liste des vélos, voici la structure de données

0 commit comments

Comments
 (0)