feat: add bookable flag to product export rooms
This commit is contained in:
1 parent
2b27b9809d
commit
0ff312c0c0
10 files changed
+126
-28
No files matched your search
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\BusProNet\Model;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use Symfony\Component\Serializer\Attribute\Context;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
@@ -20,6 +21,18 @@ class Room
|
||||
public const SELECTION_TYPE_BY_PAX = 'by_pax';
|
||||
public const SELECTION_TYPE_BY_ROOM = 'by_room';
|
||||
|
||||
/**
|
||||
* Whether a room with this status and availability is offered for new bookings.
|
||||
*
|
||||
* Only 'Frei' rooms with rooms left. A room on request ('Anfrage') would turn the booking
|
||||
* into an inquiry, so it is treated as sold out. Static and taking the raw values so the
|
||||
* product export and the chatbot, which hold rooms as arrays, apply the same rule.
|
||||
*/
|
||||
public static function isBookableState(?string $status, ?int $available): bool
|
||||
{
|
||||
return Constants::STATUS_AVAILABLE === $status && ($available ?? 0) > 0;
|
||||
}
|
||||
|
||||
#[Groups(['api:list', 'api:single', 'snapshot'])]
|
||||
public ?int $id = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user