test update bid use case
This commit is contained in:
parent
e4c535201b
commit
9e2e6d9449
4 changed files with 89 additions and 0 deletions
|
|
@ -59,18 +59,38 @@ class Bid
|
|||
return $this->cost;
|
||||
}
|
||||
|
||||
public function setCost(int $cost): void
|
||||
{
|
||||
$this->cost = $cost;
|
||||
}
|
||||
|
||||
public function getNotes(): ?string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function setNotes(string $notes): void
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
public function getFileAttachments(): ?array
|
||||
{
|
||||
return $this->fileAttachments;
|
||||
}
|
||||
|
||||
public function setFileAttachments(array $attachments): void
|
||||
{
|
||||
$this->fileAttachments = $attachments;
|
||||
}
|
||||
|
||||
public function isClosed(): bool
|
||||
{
|
||||
return $this->isClosed;
|
||||
}
|
||||
|
||||
public function setIsClosed(bool $isClosed): void
|
||||
{
|
||||
$this->isClosed = $isClosed;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
src/Bid/UseCases/UpdateBid.php
Normal file
22
src/Bid/UseCases/UpdateBid.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace FreightQuote\Bid\UseCases;
|
||||
|
||||
use FreightQuote\Bid\BidRepository;
|
||||
|
||||
class UpdateBid
|
||||
{
|
||||
public function __construct(
|
||||
private BidRepository $bidRepo,
|
||||
) {}
|
||||
|
||||
public function execute(UpdateBidRequest $dto): void
|
||||
{
|
||||
$bid = $this->bidRepo->find($dto->bidId);
|
||||
$bid->setCost($dto->data['cost']);
|
||||
$bid->setIsClosed($dto->data['isClosed']);
|
||||
$bid->setNotes($dto->data['notes']);
|
||||
$bid->setFileAttachments($dto->data['fileAttachments']);
|
||||
$this->bidRepo->save($bid);
|
||||
}
|
||||
}
|
||||
11
src/Bid/UseCases/UpdateBidRequest.php
Normal file
11
src/Bid/UseCases/UpdateBidRequest.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace FreightQuote\Bid\UseCases;
|
||||
|
||||
class UpdateBidRequest
|
||||
{
|
||||
public function __construct(
|
||||
public int $bidId,
|
||||
public array $data,
|
||||
) {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue