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') ); } }