6fe5c8c8d0
- 后端新增 evidence 模块(V182 证据表/独立桶/超管读取面/内部登记)与 application.yml evidence 块;管理员四端点逐个 requireSuperAdmin。 - 分片通道补 @Scheduled 回收与 LocalTempCleanupService 的 chunk-uploads 覆盖; 版本/教程 confirm 接受 file_key,把拼装件搬进 client 桶后落库。 - 用户端 9MB 视频改走 uploadTempFileToJava 分片;后管版本/教程 >8MB 走分片, 小文件仍走原 presign 直传。 - 激活 Phase 3/4 后端与两前端预置契约。
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
// AC-11(R4):后管版本/教程大档上传接线的「源码尺子」那一半。
|
||
//
|
||
// Pending Phase 4 激活。今天 `src/pages/records/version-api.ts` 与 `tutorial-api.ts`
|
||
// 都是 presign → 一次 PUT 直传(512MB 级也一样,蓝图 §1.2 R4 实读);本文件要求两条
|
||
// 路径接上既有 `/api/files/chunk/**` 分片通道(断点续传/按片重试)。
|
||
//
|
||
// 跑法:npm test(node --test tests/*.test.ts)。
|
||
import { test } from 'node:test'
|
||
import assert from 'node:assert/strict'
|
||
import { readFileSync } from 'node:fs'
|
||
import { dirname, resolve } from 'node:path'
|
||
import { fileURLToPath } from 'node:url'
|
||
|
||
const here = dirname(fileURLToPath(import.meta.url))
|
||
const root = resolve(here, '..')
|
||
|
||
const LARGE_UPLOAD_FILES = [
|
||
'src/pages/records/version-api.ts',
|
||
'src/pages/records/tutorial-api.ts',
|
||
]
|
||
|
||
test('后管版本/教程大档必须接分片通道', () => {
|
||
for (const file of LARGE_UPLOAD_FILES) {
|
||
const source = readFileSync(resolve(root, file), 'utf-8')
|
||
assert.match(
|
||
source,
|
||
/files\/chunk/,
|
||
`AC-11:${file} 仍是 presign 直传(512MB 断网从 0 重来,没有分片续传)`,
|
||
)
|
||
}
|
||
})
|
||
|
||
test('分片接线不得只落注释', () => {
|
||
for (const file of LARGE_UPLOAD_FILES) {
|
||
const source = readFileSync(resolve(root, file), 'utf-8')
|
||
const codeLines = source
|
||
.split('\n')
|
||
.filter((line) => !line.trim().startsWith('//') && !line.trim().startsWith('*'))
|
||
.join('\n')
|
||
assert.match(codeLines, /files\/chunk/, `AC-11:${file} 的分片引用只出现在注释里`)
|
||
}
|
||
})
|