API response adjustments.

This commit is contained in:
2024-05-07 22:50:09 +02:00
parent a4ec188cff
commit 7b6d1408f8
3 changed files with 12 additions and 3 deletions
@@ -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'),
+7 -3
View File
@@ -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')]
+3
View File
@@ -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();