add isClosed, notes, cost, fileAttachments to bid
This commit is contained in:
parent
d68c3bc66c
commit
04c498afb6
7 changed files with 60 additions and 4 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
- Add cost, notes, file attachments, closed to bid entity
|
|
||||||
- cost = nullable int, notes = string, files = array, closed = bool
|
|
||||||
- Add date created to freight quote entity
|
- 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
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ class Bid
|
||||||
private int $freightOrderId,
|
private int $freightOrderId,
|
||||||
private int $carrierId,
|
private int $carrierId,
|
||||||
private bool $wasOpened,
|
private bool $wasOpened,
|
||||||
|
private bool $isClosed,
|
||||||
|
private ?int $cost,
|
||||||
|
private ?string $notes,
|
||||||
|
private ?array $fileAttachments,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getId(): ?string
|
public function getId(): ?string
|
||||||
|
|
@ -49,4 +53,24 @@ class Bid
|
||||||
{
|
{
|
||||||
$this->wasOpened = $wasOpened;
|
$this->wasOpened = $wasOpened;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCost(): ?int
|
||||||
|
{
|
||||||
|
return $this->cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNotes(): ?string
|
||||||
|
{
|
||||||
|
return $this->notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileAttachments(): ?array
|
||||||
|
{
|
||||||
|
return $this->fileAttachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isClosed(): bool
|
||||||
|
{
|
||||||
|
return $this->isClosed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,10 @@ class CreateFreightOrder
|
||||||
freightOrderId: $freightOrderId,
|
freightOrderId: $freightOrderId,
|
||||||
carrierId: $carrierId,
|
carrierId: $carrierId,
|
||||||
wasOpened: false,
|
wasOpened: false,
|
||||||
|
isClosed: false,
|
||||||
|
cost: null,
|
||||||
|
notes: null,
|
||||||
|
fileAttachments: null,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@ class FakeBidRepository implements BidRepository
|
||||||
$bid->getFreightOrderId(),
|
$bid->getFreightOrderId(),
|
||||||
$bid->getCarrierId(),
|
$bid->getCarrierId(),
|
||||||
$bid->getWasOpened(),
|
$bid->getWasOpened(),
|
||||||
|
$bid->isClosed(),
|
||||||
|
$bid->getCost(),
|
||||||
|
$bid->getNotes(),
|
||||||
|
$bid->getFileAttachments(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,6 +42,10 @@ class FakeBidRepository implements BidRepository
|
||||||
$bid->getFreightOrderId(),
|
$bid->getFreightOrderId(),
|
||||||
$bid->getCarrierId(),
|
$bid->getCarrierId(),
|
||||||
$bid->getWasOpened(),
|
$bid->getWasOpened(),
|
||||||
|
$bid->isClosed(),
|
||||||
|
$bid->getCost(),
|
||||||
|
$bid->getNotes(),
|
||||||
|
$bid->getFileAttachments(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,16 @@ class BidTest extends TestCase
|
||||||
public function test_bid_link_generated(): void
|
public function test_bid_link_generated(): void
|
||||||
{
|
{
|
||||||
$bidId = '124e56abf82';
|
$bidId = '124e56abf82';
|
||||||
$bid = new Bid($bidId, 0, 0, false);
|
$bid = new Bid(
|
||||||
|
$bidId,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"https://freightquotes.com/bid/$bidId",
|
"https://freightquotes.com/bid/$bidId",
|
||||||
$bid->getBidLink()
|
$bid->getBidLink()
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,16 @@ class GetBidForCarrierTest extends TestCase
|
||||||
public function test_first_view_flips_opened_flag(): void
|
public function test_first_view_flips_opened_flag(): void
|
||||||
{
|
{
|
||||||
$bidId = 'abcd';
|
$bidId = 'abcd';
|
||||||
$this->bidRepo->save(new Bid($bidId, 0, 0, false));
|
$this->bidRepo->save(new Bid(
|
||||||
|
$bidId,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
));
|
||||||
$foundBid = $this->useCase->execute(
|
$foundBid = $this->useCase->execute(
|
||||||
new GetBidForCarrierRequest($bidId)
|
new GetBidForCarrierRequest($bidId)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -156,5 +156,9 @@ class CreateFreightOrderTest extends TestCase
|
||||||
$bid->getFreightOrderId()
|
$bid->getFreightOrderId()
|
||||||
);
|
);
|
||||||
$this->assertEquals($carrierId, $bid->getCarrierId());
|
$this->assertEquals($carrierId, $bid->getCarrierId());
|
||||||
|
$this->assertEquals(null, $bid->getCost());
|
||||||
|
$this->assertEquals(null, $bid->getNotes());
|
||||||
|
$this->assertEquals(null, $bid->getFileAttachments());
|
||||||
|
$this->assertEquals(false, $bid->isClosed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue