39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
const BASE = 'http://localhost:3002';
|
|
const PID = 'b1b5884e-ba85-4d8f-9a92-e524603587a0';
|
|
|
|
async function main() {
|
|
const login = await fetch(`${BASE}/api/auth/login`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ password: '620f4c96' })
|
|
});
|
|
const { token } = await login.json();
|
|
const auth = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` };
|
|
|
|
// Try with category_tag
|
|
const body = JSON.stringify({
|
|
title: 'test-entry-cn',
|
|
repo_url: 'https://gittea.dev/hangshuo652/jcl-cobol-git',
|
|
category_tag: '赛道一',
|
|
participant: 'hangshuo'
|
|
});
|
|
console.log('REQUEST BODY:', body);
|
|
|
|
const r = await fetch(`${BASE}/api/projects/${PID}/entries`, {
|
|
method: 'POST',
|
|
headers: auth,
|
|
body
|
|
});
|
|
const text = await r.text();
|
|
console.log('STATUS:', r.status);
|
|
console.log('RESPONSE:', text);
|
|
|
|
// Also try reading the server console
|
|
// Check the standard directly
|
|
const std = await fetch(`${BASE}/api/projects/${PID}/standards/996fa0b9-13d3-4f2f-ab32-7ce1aba14723`, { headers: auth });
|
|
const stdData = await std.json();
|
|
console.log('STANDARD dims:', stdData.dimensions?.length, 'total:', stdData.dimensions?.reduce((s,d) => s + d.maxScore, 0));
|
|
}
|
|
|
|
main().catch(console.error);
|