Kanban / timesheet update
This commit is contained in:
@@ -21,6 +21,11 @@ class FakeTaskQueries implements TaskQueries
|
||||
$this->tasks[$taskId] = new BookableTask($taskId, $jobId, '2026-0001', 'Kampanja', 'Tehtävä '.$taskId, $workTypeId, 'graafinen työ', $jobStatus, TaskStatus::Waiting);
|
||||
}
|
||||
|
||||
public function scheduledTaskIdsFor(int $userId, string $from, string $to): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function pinnedTaskIds(int $jobId): array
|
||||
{
|
||||
return [];
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fakes;
|
||||
|
||||
use App\Modules\TimeTracking\Domain\Contracts\PinnedTaskRepository;
|
||||
use DateTimeImmutable;
|
||||
|
||||
class InMemoryPinnedTaskRepository implements PinnedTaskRepository
|
||||
{
|
||||
/** @var array<int, list<int>> task ids by user id */
|
||||
public array $pins = [];
|
||||
|
||||
public function pin(int $userId, int $taskId, DateTimeImmutable $at): void
|
||||
{
|
||||
if (! in_array($taskId, $this->pins[$userId] ?? [], true)) {
|
||||
$this->pins[$userId][] = $taskId;
|
||||
}
|
||||
}
|
||||
|
||||
public function unpin(int $userId, int $taskId): void
|
||||
{
|
||||
$this->pins[$userId] = array_values(array_diff($this->pins[$userId] ?? [], [$taskId]));
|
||||
}
|
||||
|
||||
public function unpinAll(int $userId): int
|
||||
{
|
||||
$count = count($this->pins[$userId] ?? []);
|
||||
$this->pins[$userId] = [];
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function pinnedTaskIds(int $userId): array
|
||||
{
|
||||
return $this->pins[$userId] ?? [];
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class InMemoryTimeEntryRepository implements TimeEntryRepository
|
||||
public function save(TimeEntry $entry): TimeEntry
|
||||
{
|
||||
$id = $entry->id() ?? $this->nextId++;
|
||||
$this->entries[$id] = TimeEntry::reconstitute($id, $entry->userId(), $entry->taskId(), $entry->jobId(), $entry->workTypeId(), $entry->workedOn(), $entry->hours(), $entry->note(), $entry->approvedBy(), $entry->approvedAt(), $entry->billingExportId());
|
||||
$this->entries[$id] = TimeEntry::reconstitute($id, $entry->userId(), $entry->taskId(), $entry->jobId(), $entry->workTypeId(), $entry->workedOn(), $entry->hours(), $entry->note(), $entry->approvedBy(), $entry->approvedAt(), $entry->billingExportId(), $entry->billingModel(), $entry->internalComment());
|
||||
|
||||
return clone $this->entries[$id];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user