feat(tkfb): 연차 데이터 정본 전환 — vacation_balance_details → sp_vacation_balances
대시보드 + 연간 연차 현황 페이지의 읽기를 tksupport 정본 테이블로 전환. - dashboardModel: getVacationBalance worker_id → user_id, sp_vacation_balances - dashboardController: worker_id 전달 제거, user_id 직접 사용 - vacationBalanceModel: 읽기 함수 3개 sp_vacation_balances로 전환 (쓰기 함수 deductByPriority 등은 vacation_balance_details 유지) - remaining_days: STORED GENERATED 대신 (total_days - used_days) AS 계산 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,17 +27,19 @@ const DashboardModel = {
|
||||
/**
|
||||
* 연차 현황 조회 (쿼리 2)
|
||||
*/
|
||||
getVacationBalance: async (workerId, year) => {
|
||||
if (!workerId) return [];
|
||||
getVacationBalance: async (userId, year) => {
|
||||
if (!userId) return [];
|
||||
const db = await getDb();
|
||||
const [rows] = await db.execute(`
|
||||
SELECT vbd.vacation_type_id, vbd.total_days, vbd.used_days, vbd.remaining_days,
|
||||
SELECT svb.vacation_type_id, svb.total_days, svb.used_days,
|
||||
(svb.total_days - svb.used_days) AS remaining_days,
|
||||
svb.balance_type, svb.expires_at,
|
||||
vt.type_name, vt.type_code
|
||||
FROM vacation_balance_details vbd
|
||||
JOIN vacation_types vt ON vbd.vacation_type_id = vt.id
|
||||
WHERE vbd.worker_id = ? AND vbd.year = ?
|
||||
FROM sp_vacation_balances svb
|
||||
JOIN vacation_types vt ON svb.vacation_type_id = vt.id
|
||||
WHERE svb.user_id = ? AND svb.year = ?
|
||||
ORDER BY vt.priority
|
||||
`, [workerId, year]);
|
||||
`, [userId, year]);
|
||||
return rows;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user