add date created to freight quote entity

This commit is contained in:
Yisroel Baum 2025-11-22 21:30:28 +02:00
parent 04c498afb6
commit 1910581053
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 16 additions and 1 deletions

View file

@ -1,7 +1,6 @@
# TODO
- Add date created to freight quote entity
- If bid == closed, do not show bid to carriers on future requests
- Make UpdateBid use case
- Make GetBidsOfFreightOrder use case

View file

@ -18,6 +18,7 @@ class FreightOrder
private string $loadDetails,
private string $notes,
private array $fileAttachments,
private DateTime $dateCreated,
) {}
public function getId(): ?int
@ -64,4 +65,9 @@ class FreightOrder
{
return $this->fileAttachments;
}
public function getDateCreated(): DateTime
{
return $this->dateCreated;
}
}

View file

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

View file

@ -15,5 +15,6 @@ class CreateFreightOrderRequestDTO
public string $notes,
public array $fileAttachments,
public array $carrierIds,
public DateTime $dateCreated,
) {}
}

View file

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

View file

@ -37,6 +37,7 @@ class CreateFreightOrderTest extends TestCase
public function test_create_freight_order(): void
{
$now = new DateTime();
$dto = new CreateFreightOrderRequestDTO(
shipFrom: 'ny',
shipTo: 'nj',
@ -46,6 +47,7 @@ class CreateFreightOrderTest extends TestCase
notes: 'some notes',
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [],
dateCreated: $now,
);
$response = $this->useCase->execute($dto);
$createdFreightOrder = $response->freightOrder;
@ -60,6 +62,7 @@ class CreateFreightOrderTest extends TestCase
$this->assertEquals($dto->loadDetails, $foundFreightOrder->getLoadDetails());
$this->assertEquals($dto->notes, $foundFreightOrder->getNotes());
$this->assertEquals($dto->fileAttachments, $foundFreightOrder->getFileAttachments());
$this->assertEquals($dto->dateCreated, $foundFreightOrder->getDateCreated());
}
public function test_email_is_sent(): void
@ -84,6 +87,7 @@ class CreateFreightOrderTest extends TestCase
notes: 'some notes',
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [$carrierId],
dateCreated: new DateTime(),
);
$this->useCase->execute($dto);
$this->assertEquals(1, $this->emailer->getSentEmailCount());
@ -120,6 +124,7 @@ class CreateFreightOrderTest extends TestCase
notes: 'some notes',
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [0, 1],
dateCreated: new DateTime(),
);
$this->useCase->execute($dto);
$this->assertEquals(2, $this->emailer->getSentEmailCount());
@ -147,6 +152,7 @@ class CreateFreightOrderTest extends TestCase
notes: 'some notes',
fileAttachments: ['path/to/file', 'another/path/file'],
carrierIds: [$carrierId],
dateCreated: new DateTime(),
);
$response = $this->useCase->execute($dto);
$bid = $response->bidsCreated[0];