task-126(记录与版本中心): 定义软件版本 DTO

新增 version-dto.ts:软件版本行类型与版本号归一;后台/公开接口分离。

TDD: task-126.test.ts 8 用例 RED→GREEN。
This commit is contained in:
2026-09-05 17:33:42 +08:00
parent 4731c9a23c
commit 1d98315877
2 changed files with 81 additions and 0 deletions
@@ -0,0 +1,26 @@
/** 软件版本 DTO(任务 126):客户端软件版本行类型与版本号归一;后台版本与公开接口分离,纯逻辑。 */
/** 客户端软件版本行(GET /api/admin/versions data.itemsJava SoftwareVersionEntity snake)。 */
export interface SoftwareVersionItem {
id: number
version: string
fileUrl: string
createdAt: string
}
export interface SoftwareVersionList {
items: SoftwareVersionItem[]
}
export function emptySoftwareVersionList(): SoftwareVersionList {
return { items: [] }
}
/** 版本号归一:去首尾空白;空白视为空。 */
export function normalizeVersionString(value: unknown): string {
return typeof value === 'string' ? value.trim() : ''
}
export function isNonEmptyVersion(value: string): boolean {
return normalizeVersionString(value).length > 0
}