fix(tkuser): 연차 배정 모달 간소화 — 휴가유형 드롭다운 제거
- "휴가 유형" 드롭다운 → hidden (vacation_type_id 자동 설정) - "배정 유형"이 메인 셀렉터: 기본연차/이월/장기근속/경조사 - balance_type별 vacation_type_id 자동 매핑: AUTO/MANUAL→ANNUAL_FULL, CARRY_OVER→CARRYOVER, LONG_SERVICE→LONG_SERVICE - 경조사(COMPANY_GRANT) 선택 시 서브 드롭다운 표시 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@ exports.up = async function(knex) {
|
||||
table.increments('id').primary();
|
||||
table.string('type_code', 20).unique().notNullable().comment('휴가 코드');
|
||||
table.string('type_name', 50).notNullable().comment('휴가 이름');
|
||||
table.decimal('deduct_days', 3, 1).defaultTo(1.0).comment('차감 일수');
|
||||
table.decimal('deduct_days', 4, 2).defaultTo(1.00).comment('차감 일수');
|
||||
table.boolean('is_active').defaultTo(true).comment('활성 여부');
|
||||
table.timestamp('created_at').defaultTo(knex.fn.now());
|
||||
table.timestamp('updated_at').defaultTo(knex.fn.now());
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- vacation_types.deduct_days 정밀도 수정: DECIMAL(3,1) → DECIMAL(4,2)
|
||||
-- 0.25(반반차)가 0.3으로 반올림되는 문제 해결
|
||||
ALTER TABLE vacation_types MODIFY deduct_days DECIMAL(4,2) DEFAULT 1.00;
|
||||
UPDATE vacation_types SET deduct_days = 0.25 WHERE deduct_days = 0.3 AND type_name = '반반차';
|
||||
@@ -48,7 +48,7 @@ async function runStartupMigrations() {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const db = await getDb();
|
||||
const migrationFiles = ['20260326_schedule_extensions.sql', '20260330_add_proxy_input_fields.sql', '20260330_create_monthly_work_confirmations.sql'];
|
||||
const migrationFiles = ['20260326_schedule_extensions.sql', '20260330_add_proxy_input_fields.sql', '20260330_create_monthly_work_confirmations.sql', '20260331_fix_deduct_days_precision.sql'];
|
||||
for (const file of migrationFiles) {
|
||||
const sqlPath = path.join(__dirname, 'db', 'migrations', file);
|
||||
if (!fs.existsSync(sqlPath)) continue;
|
||||
|
||||
@@ -9,16 +9,21 @@
|
||||
|
||||
const AttendanceModel = require('../models/attendanceModel');
|
||||
const vacationBalanceModel = require('../models/vacationBalanceModel');
|
||||
const { getDb } = require('../dbPool');
|
||||
const { ValidationError, NotFoundError, DatabaseError } = require('../utils/errors');
|
||||
const logger = require('../utils/logger');
|
||||
|
||||
/**
|
||||
* 휴가 사용 유형 ID를 차감 일수로 변환
|
||||
* vacation_type_id: 1=연차(1일), 2=반차(0.5일), 3=반반차(0.25일)
|
||||
* 휴가 사용 유형 ID → 차감 일수 (DB vacation_types.deduct_days 조회)
|
||||
*/
|
||||
const getVacationDays = (vacationTypeId) => {
|
||||
const daysMap = { 1: 1, 2: 0.5, 3: 0.25 };
|
||||
return daysMap[vacationTypeId] || 0;
|
||||
const getVacationDays = async (vacationTypeId) => {
|
||||
if (!vacationTypeId) return 0;
|
||||
const db = await getDb();
|
||||
const [rows] = await db.execute(
|
||||
'SELECT deduct_days FROM vacation_types WHERE id = ?',
|
||||
[vacationTypeId]
|
||||
);
|
||||
return rows.length > 0 ? parseFloat(rows[0].deduct_days) || 0 : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -143,8 +148,8 @@ const upsertAttendanceRecordService = async (recordData) => {
|
||||
|
||||
// 3. 휴가 잔액 연동 (vacation_balance_details.used_days 업데이트)
|
||||
const year = new Date(record_date).getFullYear();
|
||||
const previousDays = getVacationDays(previousVacationTypeId);
|
||||
const newDays = getVacationDays(vacation_type_id);
|
||||
const previousDays = await getVacationDays(previousVacationTypeId);
|
||||
const newDays = await getVacationDays(vacation_type_id);
|
||||
|
||||
// 이전 휴가가 있었고 변경된 경우 → 복구 후 차감
|
||||
if (previousDays !== newDays) {
|
||||
|
||||
Reference in New Issue
Block a user