fix: 캘린더 모달 중복 카드 문제 및 삭제 권한 개선
- monthly_worker_status 조회 시 GROUP BY로 중복 데이터 합산 - 작업보고서 삭제 권한을 그룹장 이상으로 제한 (admin, system, group_leader) - 중복 데이터 정리를 위한 마이그레이션 SQL 추가 (009_fix_duplicate_monthly_status.sql) - synology_deployment 버전에도 동일 수정 적용
This commit is contained in:
45
synology_deployment/api/models/uploadModel.js
Normal file
45
synology_deployment/api/models/uploadModel.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const { getDb } = require('../dbPool');
|
||||
|
||||
// 1. 문서 업로드
|
||||
const create = async (doc, callback) => {
|
||||
try {
|
||||
const db = await getDb();
|
||||
const sql = `
|
||||
INSERT INTO uploaded_documents
|
||||
(title, tags, description, original_name, stored_name, file_path, file_type, file_size, submitted_by)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`;
|
||||
const values = [
|
||||
doc.title,
|
||||
doc.tags,
|
||||
doc.description,
|
||||
doc.original_name,
|
||||
doc.stored_name,
|
||||
doc.file_path,
|
||||
doc.file_type,
|
||||
doc.file_size,
|
||||
doc.submitted_by
|
||||
];
|
||||
const [result] = await db.query(sql, values);
|
||||
callback(null, result.insertId);
|
||||
} catch (err) {
|
||||
callback(new Error(err.message || String(err)));
|
||||
}
|
||||
};
|
||||
|
||||
// 2. 전체 문서 목록 조회
|
||||
const getAll = async (callback) => {
|
||||
try {
|
||||
const db = await getDb();
|
||||
const [rows] = await db.query(`SELECT * FROM uploaded_documents ORDER BY created_at DESC`);
|
||||
callback(null, rows);
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ 내보내기
|
||||
module.exports = {
|
||||
create,
|
||||
getAll
|
||||
};
|
||||
Reference in New Issue
Block a user