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

@@ -0,0 +1,11 @@
-- migration-purchase-safety-patch.sql
-- 배포 후 스키마 보완 패치
-- 생성일: 2026-03-13
-- 4-a. check_in_time NOT NULL (체크인 시 시간은 항상 존재)
ALTER TABLE partner_work_checkins
MODIFY check_in_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
-- 4-b. 일정당 하루 1건 업무보고 보장
ALTER TABLE daily_work_reports
ADD UNIQUE INDEX uq_schedule_report_date (schedule_id, report_date);

View File

@@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS partner_work_checkins (
schedule_id INT NOT NULL,
company_id INT NOT NULL,
checked_by INT NOT NULL,
check_in_time DATETIME,
check_in_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
check_out_time DATETIME,
worker_names TEXT,
actual_worker_count INT,
@@ -118,6 +118,7 @@ CREATE TABLE IF NOT EXISTS daily_work_reports (
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_daily_report_date (report_date),
INDEX idx_daily_report_schedule (schedule_id),
UNIQUE INDEX uq_schedule_report_date (schedule_id, report_date),
CONSTRAINT fk_daily_reports_schedule
FOREIGN KEY (schedule_id) REFERENCES partner_schedules(id),
CONSTRAINT fk_daily_reports_checkin