feat: CEO 대시보드 API 구현 및 DB 컬럼 오류 수정
- StatusBoardService: 현황판 8개 항목 집계 API - CalendarService: 캘린더 일정 조회 API (작업지시/계약/휴가) - TodayIssueService: 오늘의 이슈 리스트 API - VatService: 부가세 신고 현황 API - EntertainmentService: 접대비 현황 API - WelfareService: 복리후생 현황 API 버그 수정: - orders 테이블 status → status_code 컬럼명 수정 - users 테이블 department 관계 → tenantProfile.department로 수정 - Swagger 문서 및 라우트 추가
This commit is contained in:
57
app/Http/Controllers/Api/V1/CalendarController.php
Normal file
57
app/Http/Controllers/Api/V1/CalendarController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\CalendarService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* CEO 대시보드 캘린더 컨트롤러
|
||||
*/
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CalendarService $calendarService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 캘린더 일정 조회
|
||||
*
|
||||
* @param Request $request
|
||||
* - start_date: 조회 시작일 (Y-m-d, 기본: 이번 달 1일)
|
||||
* - end_date: 조회 종료일 (Y-m-d, 기본: 이번 달 말일)
|
||||
* - type: 일정 타입 필터 (schedule|order|construction|null=전체)
|
||||
* - department_filter: 부서 필터 (all|department|personal, 기본: all)
|
||||
*/
|
||||
public function summary(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'start_date' => 'nullable|date_format:Y-m-d',
|
||||
'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
|
||||
'type' => 'nullable|in:schedule,order,construction,other',
|
||||
'department_filter' => 'nullable|in:all,department,personal',
|
||||
]);
|
||||
|
||||
// 기본값 설정: 이번 달 전체
|
||||
$today = Carbon::today();
|
||||
$startDate = $validated['start_date'] ?? $today->copy()->startOfMonth()->format('Y-m-d');
|
||||
$endDate = $validated['end_date'] ?? $today->copy()->endOfMonth()->format('Y-m-d');
|
||||
$type = $validated['type'] ?? null;
|
||||
$departmentFilter = $validated['department_filter'] ?? 'all';
|
||||
|
||||
$data = $this->calendarService->getSchedules(
|
||||
$startDate,
|
||||
$endDate,
|
||||
$type,
|
||||
$departmentFilter
|
||||
);
|
||||
|
||||
return ApiResponse::handle(
|
||||
data: $data,
|
||||
message: __('message.fetched')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user