fix: 배포 후 버그 수정 — 테이블명/컬럼명 불일치, navbar active, API 검증 강화, 대시보드 통계 라우트 추가

- checkinModel: partner_checkins → partner_work_checkins, countActive() 추가
- workReportModel: partner_work_reports → daily_work_reports
- partner-portal: check_out_at/check_in_at → check_out_time/check_in_time
- checkinModel findTodayByCompany: LEFT JOIN has_work_report
- tkpurchase-core/tksafety-core: navbar match '' 제거
- checkinController: checkOut에 업무현황 검증, stats() 추가
- workReportController: checkin_id 필수 + schedule 일치 검증
- checkinRoutes: GET / 대시보드 통계 라우트 추가
- nginx.conf: visit.html → tksafety 리다이렉트
- migration-purchase-safety.sql: DDL 동기화
- migration-purchase-safety-patch.sql: 신규 패치

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-13 07:22:25 +09:00
parent b800792152
commit efc3c14db5
11 changed files with 77 additions and 29 deletions

View File

@@ -58,18 +58,23 @@ async function myReports(req, res) {
// 작업보고 등록
async function create(req, res) {
try {
const { checkin_id, company_id, report_date } = req.body;
const { checkin_id, schedule_id, company_id, report_date } = req.body;
if (!report_date) {
return res.status(400).json({ success: false, error: '보고일은 필수입니다' });
}
// checkin_id가 있으면 유효성 검증
if (checkin_id) {
const checkin = await checkinModel.findById(checkin_id);
if (!checkin) {
return res.status(400).json({ success: false, error: '유효하지 않은 체크인 ID입니다' });
}
if (!checkin_id) {
return res.status(400).json({ success: false, error: '체크인 ID는 필수입니다' });
}
const checkin = await checkinModel.findById(checkin_id);
if (!checkin) {
return res.status(400).json({ success: false, error: '유효하지 않은 체크인 ID입니다' });
}
if (schedule_id && checkin.schedule_id !== schedule_id) {
return res.status(400).json({ success: false, error: '체크인의 일정 정보가 일치하지 않습니다' });
}
const resolvedCompanyId = company_id || req.user.partner_company_id;