refactor(db): Replace SELECT * with explicit columns in models

Replaced `SELECT *` statements across multiple data models with explicit column lists to improve query performance, reduce data transfer, and increase code clarity. This is part of the Phase 2 refactoring plan.

- Refactored queries in the following models:
  - projectModel
  - toolsModel
  - attendanceModel
  - dailyIssueReportModel
  - issueTypeModel
  - workReportModel
  - userModel
  - dailyWorkReportModel

fix(api): Add missing volume mounts to docker-compose

Modified docker-compose.yml to mount the `config`, `middlewares`, `utils`, and `services` directories into the API container. This fixes a `MODULE_NOT_FOUND` error that caused the container to crash on startup.

feat(db): Add migration for missing project columns

Created a new database migration to add `is_active`, `project_status`, and `completed_date` columns to the `projects` table, resolving an inconsistency between the model code and the schema.

docs: Add deployment notes

Added a new markdown file to document the testing (macOS, Docker Desktop) and production (Synology NAS, Container Manager) environments.
This commit is contained in:
Hyungi Ahn
2025-12-19 10:33:29 +09:00
parent b67362a733
commit bc5df77595
11 changed files with 59 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ class AttendanceModel {
// 휴가 유형 정보 조회
const [vacationTypes] = await db.execute(
'SELECT * FROM vacation_types WHERE type_code = ?',
'SELECT id, type_code, type_name, hours_deduction, description, is_active, created_at, updated_at FROM vacation_types WHERE type_code = ?',
[vacationType]
);
@@ -222,7 +222,7 @@ class AttendanceModel {
static async getAttendanceTypes() {
const db = await getDb();
const [rows] = await db.execute(
'SELECT * FROM work_attendance_types WHERE is_active = TRUE ORDER BY id'
'SELECT id, type_code, type_name, description, is_active, created_at, updated_at FROM work_attendance_types WHERE is_active = TRUE ORDER BY id'
);
return rows;
}
@@ -231,7 +231,7 @@ class AttendanceModel {
static async getVacationTypes() {
const db = await getDb();
const [rows] = await db.execute(
'SELECT * FROM vacation_types WHERE is_active = TRUE ORDER BY hours_deduction DESC'
'SELECT id, type_code, type_name, hours_deduction, description, is_active, created_at, updated_at FROM vacation_types WHERE is_active = TRUE ORDER BY hours_deduction DESC'
);
return rows;
}
@@ -242,7 +242,7 @@ class AttendanceModel {
const currentYear = year || new Date().getFullYear();
const [rows] = await db.execute(`
SELECT * FROM worker_vacation_balance
SELECT id, worker_id, year, total_annual_leave, used_annual_leave, notes, created_at, updated_at FROM worker_vacation_balance
WHERE worker_id = ? AND year = ?
`, [workerId, currentYear]);