Skip to content

Commit f77422e

Browse files
authored
#510 - handle changing year for dashboard calendar (#517)
* #510 - handle changing year for dashboard calendar * #510 - lint fix * #510 - lint fix * #510 - bumps * #510 - lint fix
1 parent 132b5cc commit f77422e

File tree

12 files changed

+460
-526
lines changed

12 files changed

+460
-526
lines changed

app/Http/Controllers/DashboardController.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,12 @@
77
use Illuminate\Http\Request;
88
use Illuminate\Support\Carbon;
99
use Inertia\Response;
10-
use Toby\Domain\DailySummaryRetriever;
1110
use Toby\Domain\DashboardAggregator;
12-
use Toby\Domain\UserVacationStatsRetriever;
13-
use Toby\Domain\VacationTypeConfigRetriever;
1411

1512
class DashboardController extends Controller
1613
{
17-
public function __invoke(
18-
Request $request,
19-
UserVacationStatsRetriever $vacationStatsRetriever,
20-
VacationTypeConfigRetriever $configRetriever,
21-
DailySummaryRetriever $dailySummaryRetriever,
22-
DashboardAggregator $dashboardAggregator,
23-
): Response {
14+
public function index(Request $request, DashboardAggregator $dashboardAggregator): Response
15+
{
2416
$user = $request->user();
2517
$year = Carbon::now()->year;
2618

@@ -33,4 +25,9 @@ public function __invoke(
3325
"stats" => $dashboardAggregator->aggregateStats($user, $year),
3426
]);
3527
}
28+
29+
public function loadCalendar(Request $request, int $year, DashboardAggregator $dashboardAggregator): array
30+
{
31+
return $dashboardAggregator->aggregateCalendarData($request->user(), $year);
32+
}
3633
}

app/Http/Resources/DashboardVacationRequestResource.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
class DashboardVacationRequestResource extends JsonResource
1212
{
13+
public static $wrap = null;
1314
protected VacationTypeConfigRetriever $configRetriever;
1415

1516
public function __construct($resource)
@@ -19,8 +20,6 @@ public function __construct($resource)
1920
$this->configRetriever = app(VacationTypeConfigRetriever::class);
2021
}
2122

22-
public static $wrap = null;
23-
2423
public function toArray($request): array
2524
{
2625
return [

app/Http/Resources/VacationRequestResource.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
class VacationRequestResource extends JsonResource
1515
{
16+
public static $wrap = null;
1617
protected VacationTypeConfigRetriever $configRetriever;
1718

1819
public function __construct($resource)
@@ -22,8 +23,6 @@ public function __construct($resource)
2223
$this->configRetriever = app(VacationTypeConfigRetriever::class);
2324
}
2425

25-
public static $wrap = null;
26-
2726
public function toArray($request): array
2827
{
2928
$user = $request->user();

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dompdf/dompdf": "^3.0",
1414
"fakerphp/faker": "^1.24.1",
1515
"guzzlehttp/guzzle": "^7.9.2",
16-
"inertiajs/inertia-laravel": "^1.3.1",
16+
"inertiajs/inertia-laravel": "^2.0",
1717
"laragear/cache-query": "^4.0",
1818
"laravel/framework": "^11.34.2",
1919
"laravel/sanctum": "^4.0.5",
@@ -34,7 +34,7 @@
3434
"laravel/dusk": "^8.2.12",
3535
"mockery/mockery": "^1.6.12",
3636
"nunomaduro/collision": "^8.5.0",
37-
"phpunit/phpunit": "^11.4.4",
37+
"phpunit/phpunit": "^11.5",
3838
"spatie/laravel-ignition": "^2.9.0"
3939
},
4040
"autoload": {

0 commit comments

Comments
 (0)