Kanban / timesheet update

This commit is contained in:
2026-11-30 06:56:14 +02:00
parent 6332ff0fa9
commit a4dbe8ce09
46 changed files with 8091 additions and 331 deletions
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\Modules\TimeTracking\Application\UseCases;
use App\Modules\Shared\Application\Contracts\TransactionManager;
use App\Modules\TimeTracking\Application\Services\TimeBooking;
use App\Modules\TimeTracking\Domain\Contracts\TimeEntryRepository;
use App\Modules\TimeTracking\Domain\Enums\EntryBillingModel;
use App\Modules\TimeTracking\Domain\Exceptions\TimeApproved;
use App\Modules\TimeTracking\Domain\Exceptions\TimeEntryNotFound;
/**
* "Muokkaa kirjausta" on the time sheet: the laskutusperuste, billing note
* and internal comment of the user's entry on a task and day.
*/
final class DescribeTimeEntry
{
public function __construct(
private TimeEntryRepository $entries,
private TransactionManager $transactions,
) {}
/**
* @throws TimeEntryNotFound
* @throws TimeApproved
*/
public function execute(int $userId, int $taskId, string $day, ?EntryBillingModel $billingModel, ?string $billingNote, ?string $internalComment): void
{
$date = TimeBooking::day($day);
$this->transactions->run(function () use ($userId, $taskId, $date, $billingModel, $billingNote, $internalComment): void {
$entry = $this->entries->findForDay($userId, $taskId, $date) ?? throw new TimeEntryNotFound(0);
$entry->describe($billingModel, $billingNote, $internalComment);
$this->entries->save($entry);
});
}
}