-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧 fix(TextToSpeechController.php): import the Debug class from Symfon…
…y\Component\ErrorHandler to fix the missing import error ✨ feat(TextToSpeechController.php): add support for deleting ATIS audio files by implementing the delete method in the TextToSpeechController. The method takes in the ID of the ATIS audio file and an optional password for authentication. It performs the following steps: - Validates the request and checks if the ID is provided - Checks if the ATIS audio file exists - Checks if the file requires a password and verifies the password if provided - Deletes the file from the server - Deletes the database entry for the file - Returns a JSON response indicating the success or failure of the deletion operation 📝 chore(DeleteParameters.php): create a new class DeleteParameters in the OpenApi\Parameters\TTS namespace to define the query parameters for the delete operation. The parameters include 'id' (the ID of the ATIS audio file) and 'password' (the password for the file if it is protected). 📝 chore(ErrorMissingIdResponse.php): create a new class ErrorMissingIdResponse in the OpenApi\Responses\TTS\Delete namespace to define the response schema for the case when the ID parameter is missing. The response includes 'status', 'message', 'code', and 'data' properties. 📝 chore(ErrorNotFoundResponse.php): create a new class ErrorNotFoundResponse in the OpenApi\Responses\TTS\Delete namespace to define the response schema for the case when the ATIS audio file is not found. The response includes 'status', 'message', 'code', and 'data' properties. 📝 chore(ErrorPasswordProtectedResponse.php): create a new class ErrorPasswordProtectedResponse in the OpenApi\Responses\TTS\Delete namespace to define the response schema for the case when the ATIS audio file is password protected and the provided password is incorrect or missing. The response includes 'status', 'message', 'code', and 'data' properties. 📝 chore(SuccessResponse.php): create a new class SuccessResponse in the OpenApi\Responses\TTS\Delete namespace to define the response schema for the case when the ATIS audio file is successfully deleted. The response includes 'status', 'message', 'code', and 'data' properties.
- Loading branch information
Vahn Gomes
authored and
Vahn Gomes
committed
Jul 21, 2023
1 parent
d31c99a
commit f319262
Showing
6 changed files
with
201 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Parameters\TTS; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Parameter; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ParametersFactory; | ||
|
||
class DeleteParameters extends ParametersFactory | ||
{ | ||
/** | ||
* @return Parameter[] | ||
*/ | ||
public function build(): array | ||
{ | ||
return [ | ||
|
||
Parameter::query() | ||
->name('id') | ||
->description('The ID of the ATIS audio file.') | ||
->required() | ||
->schema(Schema::string()), | ||
Parameter::query() | ||
->name('password') | ||
->description('The password for the ATIS audio file if it is protected.') | ||
->schema(Schema::string()), | ||
|
||
]; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/OpenApi/Responses/TTS/Delete/ErrorMissingIdResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\Delete; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class ErrorMissingIdResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('error'), | ||
Schema::string('message')->example('You must provide an ATIS ID.'), | ||
Schema::integer('code')->example(400), | ||
Schema::object('data')->nullable() | ||
); | ||
|
||
return Response::create('TTSErrorMissingId') | ||
->description('Missing ATIS ID') | ||
->content( | ||
MediaType::json()->schema($response) | ||
); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/OpenApi/Responses/TTS/Delete/ErrorNotFoundResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\Delete; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class ErrorNotFoundResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('error'), | ||
Schema::string('message')->example('ATIS audio file not found.'), | ||
Schema::integer('code')->example(404), | ||
Schema::object('data')->nullable() | ||
); | ||
|
||
return Response::create('TTSErrorNotFound') | ||
->description('Cannot find the ATIS audio file.') | ||
->content( | ||
MediaType::json()->schema($response) | ||
); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/OpenApi/Responses/TTS/Delete/ErrorPasswordProtectedResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\Delete; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class ErrorPasswordProtectedResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('error'), | ||
Schema::string('message')->example('Password is missing or incorrect.'), | ||
Schema::integer('code')->example(401), | ||
Schema::object('data')->nullable() | ||
); | ||
|
||
return Response::create('ErrorPasswordProtectedResponse') | ||
->description('Password is missing or incorrect.') | ||
->content( | ||
MediaType::json()->schema($response) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\Delete; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class SuccessResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('success'), | ||
Schema::string('message')->example('ATIS audio file deleted successfully.'), | ||
Schema::integer('code')->example(200), | ||
Schema::object('data')->nullable() | ||
); | ||
|
||
return Response::create('DeleteTTSSuccess') | ||
->description('Success response') | ||
->content(MediaType::json()->schema($response)); | ||
} | ||
} |