add properties to freight order
This commit is contained in:
parent
6ad041a945
commit
423439e897
3 changed files with 85 additions and 4 deletions
|
|
@ -2,9 +2,63 @@
|
|||
|
||||
namespace FreightQuote\FreightOrder;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class FreightOrder
|
||||
{
|
||||
public function getId()
|
||||
public function __construct(
|
||||
private ?int $id,
|
||||
private string $shipFrom,
|
||||
private string $shipTo,
|
||||
private DateTime $pickupDate,
|
||||
private DateTime $deliveryDeadline,
|
||||
private string $loadDetails,
|
||||
private string $notes,
|
||||
private array $fileAttachments,
|
||||
) {}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getShipFrom(): string
|
||||
{
|
||||
return $this->shipFrom;
|
||||
}
|
||||
|
||||
public function getShipTo(): string
|
||||
{
|
||||
return $this->shipTo;
|
||||
}
|
||||
|
||||
public function getPickupDate(): DateTime
|
||||
{
|
||||
return $this->pickupDate;
|
||||
}
|
||||
|
||||
public function getDeliveryDeadline(): DateTime
|
||||
{
|
||||
return $this->deliveryDeadline;
|
||||
}
|
||||
|
||||
public function getLoadDetails(): string
|
||||
{
|
||||
return $this->loadDetails;
|
||||
}
|
||||
|
||||
public function getNotes(): string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function getFileAttachments(): array
|
||||
{
|
||||
return $this->fileAttachments;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,28 @@
|
|||
|
||||
namespace FreightQuote\FreightOrder\UseCases;
|
||||
|
||||
use FreightQuote\FreightOrder\FreightOrderRepository;
|
||||
use FreightQuote\FreightOrder\FreightOrder;
|
||||
|
||||
class CreateFreightOrder
|
||||
{
|
||||
public function execute(): ?FreightOrder
|
||||
{
|
||||
return new FreightOrder();
|
||||
public function __construct(
|
||||
private FreightOrderRepository $freightOrderRepo,
|
||||
) {}
|
||||
|
||||
public function execute(
|
||||
CreateFreightOrderRequestDTO $dto,
|
||||
): FreightOrder {
|
||||
return $this->freightOrderRepo->save(
|
||||
new FreightOrder(
|
||||
null,
|
||||
$dto->shipFrom,
|
||||
$dto->shipTo,
|
||||
$dto->pickupDate,
|
||||
$dto->deliveryDeadline,
|
||||
$dto->loadDetails,
|
||||
$dto->notes,
|
||||
$dto->fileAttachments,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,17 @@
|
|||
|
||||
namespace FreightQuote\FreightOrder\UseCases;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class CreateFreightOrderRequestDTO
|
||||
{
|
||||
public function __construct(
|
||||
public string $shipFrom,
|
||||
public string $shipTo,
|
||||
public DateTime $pickupDate,
|
||||
public DateTime $deliveryDeadline,
|
||||
public string $loadDetails,
|
||||
public string $notes,
|
||||
public array $fileAttachments,
|
||||
) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue