refactor(reporting): use Lombok injection constructors

This commit is contained in:
sechmachine
2026-08-15 11:32:59 +07:00
parent b9b150ff8c
commit e2b206c27e
3 changed files with 103 additions and 28 deletions
@@ -2,6 +2,7 @@ package com.lab.labtimesheet.feature.reporting.controller;
import com.lab.labtimesheet.feature.reporting.exception.DashboardAccessDeniedException;
import com.lab.labtimesheet.feature.reporting.service.DashboardService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -14,19 +15,11 @@ import org.springframework.web.bind.annotation.GetMapping;
* reloads and revalidates the persisted account role and lifecycle before returning any data.
*/
@Controller
@RequiredArgsConstructor
public class DashboardController {
private final DashboardService dashboardService;
/**
* Creates the dashboard endpoint backed by the reporting composition service.
*
* @param dashboardService service that authorizes and assembles role-scoped dashboard data
*/
public DashboardController(DashboardService dashboardService) {
this.dashboardService = dashboardService;
}
/**
* Renders the dashboard permitted by the caller's authenticated global role.
*
@@ -16,6 +16,7 @@ import com.lab.labtimesheet.feature.project.model.dto.ProjectDashboardSummary;
import com.lab.labtimesheet.feature.project.service.ProjectQueryService;
import com.lab.labtimesheet.feature.task.model.dto.TaskDashboardView;
import com.lab.labtimesheet.feature.task.service.TaskDashboardService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -28,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class DashboardService {
private final AccountService accounts;
@@ -35,25 +37,6 @@ public class DashboardService {
private final TaskDashboardService tasks;
private final AttendanceApplicationService attendance;
/**
* Creates a reporting coordinator over the concrete feature query boundaries.
*
* @param accounts account identity and Admin summary boundary
* @param projects role-scoped Project summary boundary
* @param tasks role-scoped Task dashboard boundary
* @param attendance attendance state boundary using the active policy business date
*/
public DashboardService(
AccountService accounts,
ProjectQueryService projects,
TaskDashboardService tasks,
AttendanceApplicationService attendance) {
this.accounts = accounts;
this.projects = projects;
this.tasks = tasks;
this.attendance = attendance;
}
/**
* Builds system-wide Admin counts after confirming an active persisted Admin identity.
*