完成評審評分機制
This commit is contained in:
66
scripts/create-virtual-app-api.js
Normal file
66
scripts/create-virtual-app-api.js
Normal file
@@ -0,0 +1,66 @@
|
||||
// =====================================================
|
||||
// 通過 API 創建虛擬應用記錄
|
||||
// =====================================================
|
||||
|
||||
async function createVirtualApp() {
|
||||
console.log('🔧 通過 API 創建虛擬應用記錄...\n');
|
||||
|
||||
try {
|
||||
// 等待服務器啟動
|
||||
console.log('⏳ 等待服務器啟動...');
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
|
||||
// 創建虛擬應用記錄
|
||||
const virtualAppData = {
|
||||
id: 'team_t1757702332911zcl6iafq1',
|
||||
name: '[團隊評分] aaa',
|
||||
description: '團隊 aaa 的評分記錄',
|
||||
creator_id: '00000000-0000-0000-0000-000000000000',
|
||||
category: 'team_scoring',
|
||||
type: 'team',
|
||||
app_url: null,
|
||||
icon: 'Users',
|
||||
icon_color: 'from-gray-500 to-gray-600',
|
||||
likes_count: 0,
|
||||
views_count: 0,
|
||||
rating: 0.00,
|
||||
is_active: true
|
||||
};
|
||||
|
||||
console.log('📝 創建虛擬應用數據:');
|
||||
console.log(JSON.stringify(virtualAppData, null, 2));
|
||||
|
||||
try {
|
||||
const response = await fetch('http://localhost:3000/api/apps', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(virtualAppData)
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
console.log('\n📊 API 回應:');
|
||||
console.log('狀態碼:', response.status);
|
||||
console.log('回應數據:', JSON.stringify(data, null, 2));
|
||||
|
||||
if (data.success) {
|
||||
console.log('✅ 虛擬應用創建成功!');
|
||||
} else {
|
||||
console.log('❌ 虛擬應用創建失敗:', data.message);
|
||||
if (data.error) {
|
||||
console.log('錯誤詳情:', data.error);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ API 調用失敗:', error.message);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 測試失敗:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 執行創建
|
||||
createVirtualApp();
|
Reference in New Issue
Block a user