新增歷史履歷

This commit is contained in:
2025-09-23 20:58:50 +08:00
parent 60358bca3e
commit d9fd0e4fbd
4 changed files with 351 additions and 144 deletions

View File

@@ -164,7 +164,7 @@ export class CriteriaItemService {
items = [];
}
// 手動排序項目
items.sort((a, b) => (a.sort_order || 0) - (b.sort_order || 0));
items.sort((a: any, b: any) => (a.sort_order || 0) - (b.sort_order || 0));
} catch (error) {
console.error('解析 items JSON 失敗:', error);
console.error('原始 items 數據:', row.items);
@@ -190,7 +190,7 @@ export class CriteriaItemService {
name: row.name,
description: row.description,
weight: Number(row.weight) || 0,
maxScore: Number(row.max_score) || 10, // 映射 max_score 到 maxScore 並轉換為數字
max_score: Number(row.max_score) || 10,
sort_order: row.sort_order,
created_at: row.created_at,
updated_at: row.updated_at
@@ -240,6 +240,14 @@ export class ProjectService {
return rows.length > 0 ? rows[0] : null;
}
static async getAll(): Promise<Project[]> {
const sql = `
SELECT * FROM projects
ORDER BY created_at DESC
`;
return await query(sql, []) as Project[];
}
static async findByUserId(userId: number, limit = 20, offset = 0): Promise<Project[]> {
const sql = `
SELECT * FROM projects
@@ -266,7 +274,7 @@ export class ProjectService {
template,
files,
websites,
evaluation,
evaluation: evaluation || undefined,
};
}