add carriers to freight order

This commit is contained in:
Yisroel Baum 2025-11-13 20:44:13 +02:00
parent 0afdaa76d6
commit b58d23f084
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
5 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,7 @@ class FreightOrder
private string $loadDetails, private string $loadDetails,
private string $notes, private string $notes,
private array $fileAttachments, private array $fileAttachments,
private array $carrierIds,
) {} ) {}
public function getId(): ?int public function getId(): ?int
@ -61,4 +62,9 @@ class FreightOrder
{ {
return $this->fileAttachments; return $this->fileAttachments;
} }
public function getCarrierIds(): array
{
return $this->carrierIds;
}
} }

View file

@ -24,6 +24,7 @@ class CreateFreightOrder
$dto->loadDetails, $dto->loadDetails,
$dto->notes, $dto->notes,
$dto->fileAttachments, $dto->fileAttachments,
$dto->carrierIds,
)); ));
} }
} }

View file

@ -14,5 +14,6 @@ class CreateFreightOrderRequestDTO
public string $loadDetails, public string $loadDetails,
public string $notes, public string $notes,
public array $fileAttachments, public array $fileAttachments,
public array $carrierIds,
) {} ) {}
} }

View file

@ -25,6 +25,7 @@ class FakeFreightOrderRepository implements FreightOrderRepository
$freightOrder->getLoadDetails(), $freightOrder->getLoadDetails(),
$freightOrder->getNotes(), $freightOrder->getNotes(),
$freightOrder->getFileAttachments(), $freightOrder->getFileAttachments(),
$freightOrder->getCarrierIds(),
); );
} }
} }
@ -49,6 +50,7 @@ class FakeFreightOrderRepository implements FreightOrderRepository
$freightOrder->getLoadDetails(), $freightOrder->getLoadDetails(),
$freightOrder->getNotes(), $freightOrder->getNotes(),
$freightOrder->getFileAttachments(), $freightOrder->getFileAttachments(),
$freightOrder->getCarrierIds(),
); );
} }

View file

@ -33,6 +33,7 @@ class CreateFreightOrderTest extends TestCase
loadDetails: 'some details', loadDetails: 'some details',
notes: 'some notes', notes: 'some notes',
fileAttachments: ['path/to/file', 'another/path/file'], fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [0, 1, 2],
); );
$createdFreightOrder = $this->useCase->execute($dto); $createdFreightOrder = $this->useCase->execute($dto);
$foundFreightOrder = $this->freightOrderRepo->find( $foundFreightOrder = $this->freightOrderRepo->find(
@ -46,6 +47,7 @@ class CreateFreightOrderTest extends TestCase
$this->assertEquals($dto->loadDetails, $foundFreightOrder->getLoadDetails()); $this->assertEquals($dto->loadDetails, $foundFreightOrder->getLoadDetails());
$this->assertEquals($dto->notes, $foundFreightOrder->getNotes()); $this->assertEquals($dto->notes, $foundFreightOrder->getNotes());
$this->assertEquals($dto->fileAttachments, $foundFreightOrder->getFileAttachments()); $this->assertEquals($dto->fileAttachments, $foundFreightOrder->getFileAttachments());
$this->assertEquals($dto->carrierIds, $foundFreightOrder->getCarrierIds());
} }
public function test_carrier_is_connected_to_order(): void public function test_carrier_is_connected_to_order(): void