backup: 完成 HR_position_ 表格前綴重命名與欄位對照表整理

變更內容:
- 所有資料表加上 HR_position_ 前綴
- 整理完整欄位顯示名稱與 ID 對照表
- 模組化 JS 檔案 (admin.js, ai.js, csv.js 等)
- 專案結構優化 (docs/, scripts/, tests/ 等)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-09 12:05:20 +08:00
parent a068ef9704
commit a6af297623
82 changed files with 8685 additions and 4933 deletions

53
scripts/fix_csv_routes.py Normal file
View File

@@ -0,0 +1,53 @@
"""
修復 app_updated.py 中重複的 CSV 路由
"""
import re
# 讀取檔案
with open('app_updated.py', 'r', encoding='utf-8') as f:
content = f.read()
# 找到並刪除重複的 CSV 匯入/匯出 API 區塊 (第 852 行開始)
# 保留第一次定義(已經移到正確位置的),刪除後面的重複定義
# 找到 "# ==================== CSV 匯入/匯出 API ====================" 的位置
csv_section_pattern = r'# ====================CSV匯入/匯出 API ====================.*?(?=# ====================)'
# 刪除重複的 CSV 區塊 (保留第一次定義)
lines = content.split('\n')
new_lines = []
skip_until_next_section = False
first_csv_section_found = False
i = 0
while i < len(lines):
line = lines[i]
# 檢查是否是 CSV 匯入/匯出 API 區段
if '# ==================== CSV 匯入/匯出 API ====================' in line:
if not first_csv_section_found:
# 第一次遇到,跳過這個區塊(因為我們已經在前面定義了)
first_csv_section_found = True
skip_until_next_section = True
else:
# 第二次遇到重複區塊,跳過
skip_until_next_section = True
# 檢查是否遇到下一個區段
if skip_until_next_section and '# ====================' in line and 'CSV 匯入/匯出' not in line:
skip_until_next_section = False
new_lines.append(line)
i += 1
continue
if not skip_until_next_section:
new_lines.append(line)
i += 1
# 寫回檔案
with open('app_updated.py', 'w', encoding='utf-8') as f:
f.write('\n'.join(new_lines))
print("已修復 CSV 路由重複問題")