feat: 작업일정 기간 기반 + 프로젝트 연결

- partner_schedules: work_date → start_date/end_date 기간 기반으로 변경
- project_id 컬럼 추가 (projects 테이블 연결, 선택사항)
- 프로젝트 조회 API 추가 (GET /projects/active)
- 일정 조회 시 기간 겹침 조건으로 필터링
- 체크인 시 기간 내 검증 추가
- 프론트엔드: 시작일/종료일 입력 + 프로젝트 선택 드롭다운
- 마이그레이션 SQL 포함 (scripts/migration-schedule-daterange.sql)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-13 08:18:53 +09:00
parent fa4c899d95
commit b5b0fa1728
12 changed files with 228 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
const checkinModel = require('../models/checkinModel');
const workReportModel = require('../models/workReportModel');
const scheduleModel = require('../models/scheduleModel');
// 일정별 체크인 목록
async function list(req, res) {
@@ -38,6 +39,20 @@ async function checkIn(req, res) {
if (!resolvedCompanyId) {
return res.status(400).json({ success: false, error: '업체 정보가 필요합니다' });
}
// 일정 기간 내 체크인 검증
const schedule = await scheduleModel.findById(schedule_id);
if (!schedule) {
return res.status(404).json({ success: false, error: '일정을 찾을 수 없습니다' });
}
const today = new Date();
today.setHours(0, 0, 0, 0);
const startDate = new Date(schedule.start_date);
startDate.setHours(0, 0, 0, 0);
const endDate = new Date(schedule.end_date);
endDate.setHours(0, 0, 0, 0);
if (today < startDate || today > endDate) {
return res.status(400).json({ success: false, error: '오늘은 해당 일정의 작업 기간이 아닙니다' });
}
const data = {
schedule_id,
company_id: resolvedCompanyId,