feat: [calendar,vat] 캘린더 CRUD 및 부가세 상세 조회 API 추가
- CalendarController/Service: 일정 등록/수정/삭제 API 추가 - VatController/Service: getDetail() 상세 조회 (요약, 참조테이블, 미발행 목록, 신고기간 옵션) - 라우트: POST/PUT/DELETE /calendar/schedules, GET /vat/detail 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -226,6 +226,78 @@ private function getLeaveSchedules(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 일정 등록
|
||||
*/
|
||||
public function createSchedule(array $data): array
|
||||
{
|
||||
$schedule = Schedule::create([
|
||||
'tenant_id' => $this->tenantId(),
|
||||
'title' => $data['title'],
|
||||
'description' => $data['description'] ?? null,
|
||||
'start_date' => $data['start_date'],
|
||||
'end_date' => $data['end_date'],
|
||||
'start_time' => $data['start_time'] ?? null,
|
||||
'end_time' => $data['end_time'] ?? null,
|
||||
'is_all_day' => $data['is_all_day'] ?? true,
|
||||
'type' => Schedule::TYPE_EVENT,
|
||||
'color' => $data['color'] ?? null,
|
||||
'is_active' => true,
|
||||
'created_by' => $this->apiUserId(),
|
||||
]);
|
||||
|
||||
return [
|
||||
'id' => $schedule->id,
|
||||
'title' => $schedule->title,
|
||||
'start_date' => $schedule->start_date?->format('Y-m-d'),
|
||||
'end_date' => $schedule->end_date?->format('Y-m-d'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 일정 수정
|
||||
*/
|
||||
public function updateSchedule(int $id, array $data): array
|
||||
{
|
||||
$schedule = Schedule::where('tenant_id', $this->tenantId())
|
||||
->findOrFail($id);
|
||||
|
||||
$schedule->update([
|
||||
'title' => $data['title'],
|
||||
'description' => $data['description'] ?? null,
|
||||
'start_date' => $data['start_date'],
|
||||
'end_date' => $data['end_date'],
|
||||
'start_time' => $data['start_time'] ?? null,
|
||||
'end_time' => $data['end_time'] ?? null,
|
||||
'is_all_day' => $data['is_all_day'] ?? true,
|
||||
'color' => $data['color'] ?? null,
|
||||
'updated_by' => $this->apiUserId(),
|
||||
]);
|
||||
|
||||
return [
|
||||
'id' => $schedule->id,
|
||||
'title' => $schedule->title,
|
||||
'start_date' => $schedule->start_date?->format('Y-m-d'),
|
||||
'end_date' => $schedule->end_date?->format('Y-m-d'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 일정 삭제 (소프트 삭제)
|
||||
*/
|
||||
public function deleteSchedule(int $id): array
|
||||
{
|
||||
$schedule = Schedule::where('tenant_id', $this->tenantId())
|
||||
->findOrFail($id);
|
||||
|
||||
$schedule->update(['deleted_by' => $this->apiUserId()]);
|
||||
$schedule->delete();
|
||||
|
||||
return [
|
||||
'id' => $schedule->id,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 범용 일정 조회 (본사 공통 + 테넌트 일정)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user