API Search - Renames route "api/search/fares" to "api/search/prices".
- Renamed Request/Response items as well.
This commit is contained in:
@@ -7,8 +7,8 @@ use App\Repository\RoomAvailabilityRepository;
|
|||||||
use App\Repository\RoomCategoryRepository;
|
use App\Repository\RoomCategoryRepository;
|
||||||
use App\Request\SearchAvailabilityPeriodRequest;
|
use App\Request\SearchAvailabilityPeriodRequest;
|
||||||
use App\Response\SearchAvailabilityResponse;
|
use App\Response\SearchAvailabilityResponse;
|
||||||
use App\Request\SearchFareCategoryRequest;
|
use App\Request\SearchPricesForCategoryRequest;
|
||||||
use App\Response\SearchFareCategoryResponse;
|
use App\Response\SearchPricesForCategoryResponse;
|
||||||
use App\Service\PricesService;
|
use App\Service\PricesService;
|
||||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
@@ -89,7 +89,7 @@ class SearchRoomsController extends AbstractController
|
|||||||
* Returns price for a room category.
|
* Returns price for a room category.
|
||||||
* This price is the total for all the selected days by guest number.
|
* This price is the total for all the selected days by guest number.
|
||||||
*/
|
*/
|
||||||
#[Route('/api/search/fares', name: 'app_search_faresForCategory', methods: ["POST"], format: "json")]
|
#[Route('/api/search/prices', name: 'app_search_pricesForCategory', methods: ["POST"], format: "json")]
|
||||||
#[OA\Tag(name: "Searchs")]
|
#[OA\Tag(name: "Searchs")]
|
||||||
#[OA\Response(
|
#[OA\Response(
|
||||||
response: 200,
|
response: 200,
|
||||||
@@ -100,7 +100,7 @@ class SearchRoomsController extends AbstractController
|
|||||||
new OA\Property(
|
new OA\Property(
|
||||||
property: "results",
|
property: "results",
|
||||||
type: "array",
|
type: "array",
|
||||||
items: new OA\Items(ref: new Model(type: SearchFareCategoryResponse::class))
|
items: new OA\Items(ref: new Model(type: SearchPricesForCategoryResponse::class))
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -108,14 +108,14 @@ class SearchRoomsController extends AbstractController
|
|||||||
#[OA\RequestBody(
|
#[OA\RequestBody(
|
||||||
content: new OA\JsonContent(
|
content: new OA\JsonContent(
|
||||||
type: 'object',
|
type: 'object',
|
||||||
ref: new Model(type: SearchFareCategoryRequest::class),
|
ref: new Model(type: SearchPricesForCategoryRequest::class),
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
public function getFaresForCategoryOnPeriod(
|
public function getPricesForCategoryOnPeriod(
|
||||||
Request $request,
|
Request $request,
|
||||||
RoomCategoryRepository $repoCat,
|
RoomCategoryRepository $repoCat,
|
||||||
PricesService $priceService,
|
PricesService $priceService,
|
||||||
#[MapRequestPayload()] SearchFareCategoryRequest $searchRequest
|
#[MapRequestPayload()] SearchPricesForCategoryRequest $searchRequest
|
||||||
): Response {
|
): Response {
|
||||||
if (\is_null($searchRequest)) {
|
if (\is_null($searchRequest)) {
|
||||||
throw new \Exception('Invalid Payload', 400);
|
throw new \Exception('Invalid Payload', 400);
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ namespace App\Request;
|
|||||||
|
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
|
|
||||||
class SearchFareCategoryRequest
|
class SearchPricesForCategoryRequest
|
||||||
{
|
{
|
||||||
#[OA\Property(description: 'Room category ID')]
|
#[OA\Property(description: 'Room category ID')]
|
||||||
public int $roomCategory;
|
public int $roomCategory;
|
||||||
+1
-1
@@ -4,7 +4,7 @@ namespace App\Response;
|
|||||||
|
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
|
|
||||||
class SearchFareCategoryResponse
|
class SearchPricesForCategoryResponse
|
||||||
{
|
{
|
||||||
#[OA\Property(description: 'Number of guests')]
|
#[OA\Property(description: 'Number of guests')]
|
||||||
public int $guestNumber;
|
public int $guestNumber;
|
||||||
Reference in New Issue
Block a user