Fix download functionality and attachment display
Some checks failed
Deploy to Vercel / deploy (push) Has been cancelled
Deploy to Railway / deploy (push) Has been cancelled

- Fixed MariaDB compatible download API for NAS deployment
- Updated SQLite schema to remove deprecated file_data column
- Enhanced attachment display consistency between admin and public pages
- Resolved category ordering issues in SQLite environment
- Added NAS MariaDB remote connection configuration
- Improved file upload and download functionality for both environments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-22 15:44:54 +09:00
parent 7be1f2ed07
commit bda299a6c3
3 changed files with 69 additions and 70 deletions

View File

@@ -364,8 +364,8 @@ class DatabaseHelper {
return new Promise((resolve, reject) => {
const query = `
INSERT INTO file_attachments (file_id, original_name, file_name, file_path, file_size, mime_type, file_data)
VALUES (?, ?, ?, ?, ?, ?, ?)
INSERT INTO file_attachments (file_id, original_name, file_name, file_path, file_size, mime_type)
VALUES (?, ?, ?, ?, ?, ?)
`;
const params = [
@@ -374,8 +374,7 @@ class DatabaseHelper {
attachmentData.file_name || attachmentData.original_name,
attachmentData.file_path || '',
attachmentData.file_size || 0,
attachmentData.mime_type || '',
attachmentData.file_data || null
attachmentData.mime_type || ''
];
this.db.run(query, params, function(err) {
@@ -410,7 +409,7 @@ class DatabaseHelper {
await this.connect();
return new Promise((resolve, reject) => {
const query = 'SELECT * FROM categories ORDER BY is_default DESC, name ASC';
const query = 'SELECT * FROM categories ORDER BY name ASC';
this.db.all(query, [], (err, rows) => {
if (err) {

View File

@@ -10,12 +10,12 @@ class MariaDBHelper {
const isNAS = process.env.NODE_ENV === 'production' || process.env.DEPLOY_ENV === 'nas';
if (isWindows) {
// Windows 개발 환경 (로컬 MariaDB/MySQL)
// Windows 개발 환경 (NAS MariaDB 원격 접속)
this.config = {
host: process.env.DB_HOST || 'localhost',
host: process.env.DB_HOST || '119.64.1.86',
port: process.env.DB_PORT || 3306,
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || '',
user: process.env.DB_USER || 'jaryo_user',
password: process.env.DB_PASSWORD || 'JaryoPass2024!@#',
database: process.env.DB_NAME || 'jaryo',
charset: 'utf8mb4'
};