task-126(记录与版本中心): 定义软件版本 DTO
新增 version-dto.ts:软件版本行类型与版本号归一;后台/公开接口分离。 TDD: task-126.test.ts 8 用例 RED→GREEN。
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/** 软件版本 DTO(任务 126):客户端软件版本行类型与版本号归一;后台版本与公开接口分离,纯逻辑。 */
|
||||
|
||||
/** 客户端软件版本行(GET /api/admin/versions data.items,Java 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
|
||||
}
|
||||
Reference in New Issue
Block a user