feat: 完善安装部署与数字溯源码
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsBoolean, IsIn, IsInt, IsNotEmpty, IsOptional, IsString, IsUrl, MaxLength, Min, MinLength, ValidateNested } from 'class-validator';
|
||||
|
||||
export class InstallMysqlDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
host!: string;
|
||||
|
||||
@ApiProperty({ default: 3306 })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
port!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
database!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
username!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
password!: string;
|
||||
}
|
||||
|
||||
export class InstallRedisDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
host!: string;
|
||||
|
||||
@ApiProperty({ default: 6379 })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
port!: number;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export class InstallAdminDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(50)
|
||||
username!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@MinLength(6)
|
||||
@MaxLength(64)
|
||||
password!: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(50)
|
||||
realName?: string;
|
||||
}
|
||||
|
||||
export class InstallStorageDto {
|
||||
@ApiProperty({ enum: ['local', 'oss'] })
|
||||
@IsIn(['local', 'oss'])
|
||||
driver!: 'local' | 'oss';
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
localDir?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
cdnBaseUrl?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ossEndpoint?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ossRegion?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ossBucket?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ossAccessKeyId?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ossAccessKeySecret?: string;
|
||||
}
|
||||
|
||||
export class InstallRequestDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
appName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsUrl({ require_tld: false })
|
||||
baseUrl!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsUrl({ require_tld: false })
|
||||
clientBaseUrl!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ValidateNested()
|
||||
@Type(() => InstallMysqlDto)
|
||||
mysql!: InstallMysqlDto;
|
||||
|
||||
@ApiProperty()
|
||||
@ValidateNested()
|
||||
@Type(() => InstallRedisDto)
|
||||
redis!: InstallRedisDto;
|
||||
|
||||
@ApiProperty()
|
||||
@ValidateNested()
|
||||
@Type(() => InstallAdminDto)
|
||||
admin!: InstallAdminDto;
|
||||
|
||||
@ApiProperty()
|
||||
@ValidateNested()
|
||||
@Type(() => InstallStorageDto)
|
||||
storage!: InstallStorageDto;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
jwtSecret?: string;
|
||||
|
||||
@ApiPropertyOptional({ default: '7d' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
jwtExpiresIn?: string;
|
||||
|
||||
@ApiPropertyOptional({ default: false })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
backupEnabled?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user