forked from Somnia/SomniaRooms
API response adjustments.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Controller\Admin;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
|
||||
@@ -27,6 +28,7 @@ class RoomCategoryCrudController extends AbstractCrudController
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
//IdField::new('id'),
|
||||
TextField::new('name'),
|
||||
TextField::new('description'),
|
||||
TextField::new('bedType'),
|
||||
|
||||
@@ -27,7 +27,7 @@ class SearchRoomsController extends AbstractController
|
||||
|
||||
$rs = $repoAvailability->getAvailabilityForPeriod($startDate, $endDate);
|
||||
|
||||
return $this->json($rs);
|
||||
return $this->json(["results" => $rs]);
|
||||
}
|
||||
|
||||
#[Route('/api/search/availabilityDetails', name: 'app_search_availabilityDetails')]
|
||||
@@ -70,9 +70,13 @@ class SearchRoomsController extends AbstractController
|
||||
throw new \Exception('Invalid time interval', 400);
|
||||
}
|
||||
|
||||
$rs = $priceService->getFinalPricesForSearch($roomCategory, $startDate, $endDate);
|
||||
$fareList = $priceService->getFinalPricesForSearch($roomCategory, $startDate, $endDate);
|
||||
$rs = [];
|
||||
foreach ($fareList as $key => $value) {
|
||||
$rs[] = [ "guestNumber" => $key, "price" => $value];
|
||||
}
|
||||
|
||||
return $this->json(["prices" => $rs]);
|
||||
return $this->json(["results" => $rs]);
|
||||
}
|
||||
|
||||
#[Route('/search/debug', name: 'app_search_faresDebug')]
|
||||
|
||||
@@ -52,6 +52,9 @@ class FareTableRepository extends ServiceEntityRepository
|
||||
public function getAllowedGuestNumberOnFareTableList(array $fareTableList): array
|
||||
{
|
||||
$fareTableCount = count($fareTableList);
|
||||
if($fareTableCount == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$fareTableIdList = \array_map(function (FareTable $element) {
|
||||
return $element->getId();
|
||||
|
||||
Reference in New Issue
Block a user