test update bid use case

This commit is contained in:
Yisroel Baum 2025-11-25 20:05:29 +02:00
parent e4c535201b
commit 9e2e6d9449
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 89 additions and 0 deletions

View file

@ -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;
}
}

View 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);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace FreightQuote\Bid\UseCases;
class UpdateBidRequest
{
public function __construct(
public int $bidId,
public array $data,
) {}
}