add properties to freight order
This commit is contained in:
parent
6ad041a945
commit
423439e897
3 changed files with 85 additions and 4 deletions
|
|
@ -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,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue