fix(tkpurchase): 협력업체 포탈 활성 일정 전체 표시로 변경

오늘 날짜 범위 필터 제거 → 마감/취소되지 않은 모든 일정 표시.
체크인 날짜 제한도 상태 기반 검증으로 변경하여 일정 기간 외에도 체크인 가능.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-13 15:21:30 +09:00
parent 7fd646e9ba
commit 0a712813e2
6 changed files with 49 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ async function myCheckins(req, res) {
if (!companyId) {
return res.status(403).json({ success: false, error: '협력업체 계정이 아닙니다' });
}
const rows = await checkinModel.findTodayByCompany(companyId);
const rows = await checkinModel.findActiveByCompany(companyId);
res.json({ success: true, data: rows });
} catch (err) {
console.error('Checkin myCheckins error:', err);
@@ -39,19 +39,13 @@ 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: '오늘은 해당 일정의 작업 기간이 아닙니다' });
if (['cancelled', 'rejected', 'completed'].includes(schedule.status)) {
return res.status(400).json({ success: false, error: '마감되었거나 취소된 일정입니다' });
}
const data = {
schedule_id,

View File

@@ -41,7 +41,7 @@ async function mySchedules(req, res) {
return res.status(403).json({ success: false, error: '협력업체 계정이 아닙니다' });
}
const [schedules, requests] = await Promise.all([
scheduleModel.findByCompanyToday(companyId),
scheduleModel.findActiveByCompany(companyId),
scheduleModel.findRequestsByCompany(companyId)
]);
res.json({ success: true, data: { schedules, requests } });