fix(数据): 支持大体积 AppData 并修正默认状态
关键改动: - 后端显式注册 10mb JSON/urlencoded body parser,支持较大的 AppData 写入 - 前端版本派生数据缺失状态时默认 planned,而不是 released - 增加请求体限制和版本默认状态测试 Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
32
apps/web/lib/derive.test.ts
Normal file
32
apps/web/lib/derive.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { flattenProjects, flattenVersions } from './derive';
|
||||
|
||||
const overview = [{
|
||||
id: 'product-1',
|
||||
name: 'Product',
|
||||
projects: [{
|
||||
id: 'project-1',
|
||||
name: 'Project',
|
||||
description: '',
|
||||
createdAt: '2026-07-02T00:00:00.000Z',
|
||||
}],
|
||||
versions: [{
|
||||
id: 'version-1',
|
||||
name: 'ProjectV1.0',
|
||||
releaseDate: null,
|
||||
createdAt: '2026-07-02T00:00:00.000Z',
|
||||
}],
|
||||
}];
|
||||
|
||||
test('flattenVersions defaults missing version status to planned', () => {
|
||||
const [version] = flattenVersions(overview);
|
||||
|
||||
assert.equal(version.status, 'planned');
|
||||
});
|
||||
|
||||
test('flattenProjects defaults nested missing version status to planned', () => {
|
||||
const [project] = flattenProjects(overview);
|
||||
|
||||
assert.equal(project.versions[0].status, 'planned');
|
||||
});
|
||||
@@ -71,7 +71,7 @@ export function flattenProjects(overview: ProductOverviewLike[]): ProjectWithCon
|
||||
.filter((v) => v.name.toLowerCase().startsWith(project.name.toLowerCase()))
|
||||
.map((v) => ({
|
||||
...v,
|
||||
status: (v.status || 'released') as VersionStatus,
|
||||
status: (v.status || 'planned') as VersionStatus,
|
||||
productId: product.id,
|
||||
productName: product.name,
|
||||
projectId: project.id,
|
||||
@@ -98,7 +98,7 @@ export function flattenVersions(overview: ProductOverviewLike[]): VersionWithCon
|
||||
);
|
||||
result.push({
|
||||
...version,
|
||||
status: (version.status || 'released') as VersionStatus,
|
||||
status: (version.status || 'planned') as VersionStatus,
|
||||
productId: product.id,
|
||||
productName: product.name,
|
||||
projectId: project?.id || '',
|
||||
|
||||
Reference in New Issue
Block a user