Files
crawler-plugin/admin-frontend-vue/src/pages/records/version-dto.ts
T
huangzd1997 1d98315877 task-126(记录与版本中心): 定义软件版本 DTO
新增 version-dto.ts:软件版本行类型与版本号归一;后台/公开接口分离。

TDD: task-126.test.ts 8 用例 RED→GREEN。
2026-09-05 17:33:42 +08:00

27 lines
822 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 软件版本 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
}