rwadurian/backend/services/mining-admin-service/src/api/dto/version/upload-version.dto.ts

48 lines
1.4 KiB
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.

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsString, IsInt, IsBoolean, IsOptional, Min, IsEnum, IsDateString } from 'class-validator'
import { Transform, Type } from 'class-transformer'
import { Platform } from '../../../domain/version-management'
export class UploadVersionDto {
@ApiProperty({ description: '平台', enum: ['ANDROID', 'IOS', 'android', 'ios'] })
@IsEnum(Platform)
@Transform(({ value }) => value?.toUpperCase())
platform: Platform
@ApiPropertyOptional({ description: '版本号 (可选可从APK/IPA自动检测)' })
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
versionCode?: number
@ApiPropertyOptional({ description: '版本名称 (可选可从APK/IPA自动检测)' })
@IsOptional()
@IsString()
versionName?: string
@ApiPropertyOptional({ description: '构建号 (可选)' })
@IsOptional()
@IsString()
buildNumber?: string
@ApiProperty({ description: '更新日志' })
@IsString()
changelog: string
@ApiProperty({ description: '是否强制更新', default: false })
@Transform(({ value }) => value === 'true' || value === true)
@IsBoolean()
isForceUpdate: boolean
@ApiPropertyOptional({ description: '最低操作系统版本' })
@IsOptional()
@IsString()
minOsVersion?: string
@ApiPropertyOptional({ description: '发布日期' })
@IsOptional()
@IsDateString()
releaseDate?: string
}