add date created to freight quote entity
This commit is contained in:
parent
04c498afb6
commit
1910581053
6 changed files with 16 additions and 1 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
- Add date created to freight quote entity
|
|
||||||
- If bid == closed, do not show bid to carriers on future requests
|
- If bid == closed, do not show bid to carriers on future requests
|
||||||
- Make UpdateBid use case
|
- Make UpdateBid use case
|
||||||
- Make GetBidsOfFreightOrder use case
|
- Make GetBidsOfFreightOrder use case
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class FreightOrder
|
||||||
private string $loadDetails,
|
private string $loadDetails,
|
||||||
private string $notes,
|
private string $notes,
|
||||||
private array $fileAttachments,
|
private array $fileAttachments,
|
||||||
|
private DateTime $dateCreated,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
|
@ -64,4 +65,9 @@ class FreightOrder
|
||||||
{
|
{
|
||||||
return $this->fileAttachments;
|
return $this->fileAttachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDateCreated(): DateTime
|
||||||
|
{
|
||||||
|
return $this->dateCreated;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ class CreateFreightOrder
|
||||||
$dto->loadDetails,
|
$dto->loadDetails,
|
||||||
$dto->notes,
|
$dto->notes,
|
||||||
$dto->fileAttachments,
|
$dto->fileAttachments,
|
||||||
|
$dto->dateCreated,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,6 @@ class CreateFreightOrderRequestDTO
|
||||||
public string $notes,
|
public string $notes,
|
||||||
public array $fileAttachments,
|
public array $fileAttachments,
|
||||||
public array $carrierIds,
|
public array $carrierIds,
|
||||||
|
public DateTime $dateCreated,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class FakeFreightOrderRepository implements FreightOrderRepository
|
||||||
$freightOrder->getLoadDetails(),
|
$freightOrder->getLoadDetails(),
|
||||||
$freightOrder->getNotes(),
|
$freightOrder->getNotes(),
|
||||||
$freightOrder->getFileAttachments(),
|
$freightOrder->getFileAttachments(),
|
||||||
|
$freightOrder->getDateCreated(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +50,7 @@ class FakeFreightOrderRepository implements FreightOrderRepository
|
||||||
$freightOrder->getLoadDetails(),
|
$freightOrder->getLoadDetails(),
|
||||||
$freightOrder->getNotes(),
|
$freightOrder->getNotes(),
|
||||||
$freightOrder->getFileAttachments(),
|
$freightOrder->getFileAttachments(),
|
||||||
|
$freightOrder->getDateCreated(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class CreateFreightOrderTest extends TestCase
|
||||||
|
|
||||||
public function test_create_freight_order(): void
|
public function test_create_freight_order(): void
|
||||||
{
|
{
|
||||||
|
$now = new DateTime();
|
||||||
$dto = new CreateFreightOrderRequestDTO(
|
$dto = new CreateFreightOrderRequestDTO(
|
||||||
shipFrom: 'ny',
|
shipFrom: 'ny',
|
||||||
shipTo: 'nj',
|
shipTo: 'nj',
|
||||||
|
|
@ -46,6 +47,7 @@ class CreateFreightOrderTest extends TestCase
|
||||||
notes: 'some notes',
|
notes: 'some notes',
|
||||||
fileAttachments: ['path/to/file', 'another/path/file'],
|
fileAttachments: ['path/to/file', 'another/path/file'],
|
||||||
carrierIds: [],
|
carrierIds: [],
|
||||||
|
dateCreated: $now,
|
||||||
);
|
);
|
||||||
$response = $this->useCase->execute($dto);
|
$response = $this->useCase->execute($dto);
|
||||||
$createdFreightOrder = $response->freightOrder;
|
$createdFreightOrder = $response->freightOrder;
|
||||||
|
|
@ -60,6 +62,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->dateCreated, $foundFreightOrder->getDateCreated());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_email_is_sent(): void
|
public function test_email_is_sent(): void
|
||||||
|
|
@ -84,6 +87,7 @@ class CreateFreightOrderTest extends TestCase
|
||||||
notes: 'some notes',
|
notes: 'some notes',
|
||||||
fileAttachments: ['path/to/file', 'another/path/file'],
|
fileAttachments: ['path/to/file', 'another/path/file'],
|
||||||
carrierIds: [$carrierId],
|
carrierIds: [$carrierId],
|
||||||
|
dateCreated: new DateTime(),
|
||||||
);
|
);
|
||||||
$this->useCase->execute($dto);
|
$this->useCase->execute($dto);
|
||||||
$this->assertEquals(1, $this->emailer->getSentEmailCount());
|
$this->assertEquals(1, $this->emailer->getSentEmailCount());
|
||||||
|
|
@ -120,6 +124,7 @@ class CreateFreightOrderTest extends TestCase
|
||||||
notes: 'some notes',
|
notes: 'some notes',
|
||||||
fileAttachments: ['path/to/file', 'another/path/file'],
|
fileAttachments: ['path/to/file', 'another/path/file'],
|
||||||
carrierIds: [0, 1],
|
carrierIds: [0, 1],
|
||||||
|
dateCreated: new DateTime(),
|
||||||
);
|
);
|
||||||
$this->useCase->execute($dto);
|
$this->useCase->execute($dto);
|
||||||
$this->assertEquals(2, $this->emailer->getSentEmailCount());
|
$this->assertEquals(2, $this->emailer->getSentEmailCount());
|
||||||
|
|
@ -147,6 +152,7 @@ class CreateFreightOrderTest extends TestCase
|
||||||
notes: 'some notes',
|
notes: 'some notes',
|
||||||
fileAttachments: ['path/to/file', 'another/path/file'],
|
fileAttachments: ['path/to/file', 'another/path/file'],
|
||||||
carrierIds: [$carrierId],
|
carrierIds: [$carrierId],
|
||||||
|
dateCreated: new DateTime(),
|
||||||
);
|
);
|
||||||
$response = $this->useCase->execute($dto);
|
$response = $this->useCase->execute($dto);
|
||||||
$bid = $response->bidsCreated[0];
|
$bid = $response->bidsCreated[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue