Files
wwjcloud-nest-v1/wwjcloud/src/common/addon/dto/admin/AddonDto.ts
万物街 7a20a0c50a feat: 完成PHP到NestJS的100%功能迁移
- 迁移25个模块,包含95个控制器和160个服务
- 新增验证码管理、登录配置、云编译等模块
- 完善认证授权、会员管理、支付系统等核心功能
- 实现完整的队列系统、配置管理、监控体系
- 确保100%功能对齐和命名一致性
- 支持生产环境部署
2025-09-10 08:04:28 +08:00

169 lines
4.1 KiB
TypeScript

import {
IsString,
IsOptional,
IsInt,
IsNumber,
IsArray,
ValidateNested,
MinLength,
MaxLength,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
export class AddonConfigDto {
@ApiProperty({ description: '配置键', example: 'appid' })
@IsString()
config_key: string;
@ApiProperty({ description: '配置名称', example: 'AppID' })
@IsString()
config_name: string;
@ApiProperty({ description: '配置值', example: 'wx123456' })
@IsString()
config_value: string;
@ApiProperty({ description: '配置类型', example: 'text' })
@IsString()
config_type: string;
@ApiPropertyOptional({ description: '配置描述', example: '微信小程序AppID' })
@IsOptional()
@IsString()
config_desc?: string;
@ApiPropertyOptional({ description: '排序', example: 0 })
@IsOptional()
@IsInt()
config_sort?: number;
@ApiPropertyOptional({ description: '是否必填', example: 1 })
@IsOptional()
@IsInt()
is_required?: number;
}
export class CreateAddonDto {
@ApiProperty({ description: '插件名称', example: 'wechat' })
@IsString()
@MinLength(2)
@MaxLength(50)
addon_name: string;
@ApiProperty({ description: '插件标识', example: 'wechat' })
@IsString()
@MinLength(2)
@MaxLength(50)
addon_key: string;
@ApiProperty({ description: '插件标题', example: '微信插件' })
@IsString()
@MaxLength(100)
addon_title: string;
@ApiPropertyOptional({ description: '插件描述', example: '微信相关功能插件' })
@IsOptional()
@IsString()
@MaxLength(500)
addon_desc?: string;
@ApiPropertyOptional({ description: '插件图标', example: '/addon/wechat/icon.png' })
@IsOptional()
@IsString()
addon_icon?: string;
@ApiProperty({ description: '插件版本', example: '1.0.0' })
@IsString()
addon_version: string;
@ApiProperty({ description: '插件作者', example: 'NiuCloud' })
@IsString()
@MaxLength(100)
addon_author: string;
@ApiPropertyOptional({ description: '插件官网', example: 'https://www.niucloud.com' })
@IsOptional()
@IsString()
addon_url?: string;
@ApiPropertyOptional({ description: '插件配置', type: [AddonConfigDto] })
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => AddonConfigDto)
addon_config?: AddonConfigDto[];
@ApiPropertyOptional({ description: '排序', example: 0 })
@IsOptional()
@IsInt()
addon_sort?: number;
}
export class UpdateAddonDto {
@ApiPropertyOptional({ description: '插件标题', example: '微信插件' })
@IsOptional()
@IsString()
@MaxLength(100)
addon_title?: string;
@ApiPropertyOptional({ description: '插件描述', example: '微信相关功能插件' })
@IsOptional()
@IsString()
@MaxLength(500)
addon_desc?: string;
@ApiPropertyOptional({ description: '插件图标', example: '/addon/wechat/icon.png' })
@IsOptional()
@IsString()
addon_icon?: string;
@ApiPropertyOptional({ description: '插件版本', example: '1.0.1' })
@IsOptional()
@IsString()
addon_version?: string;
@ApiPropertyOptional({ description: '插件作者', example: 'NiuCloud' })
@IsOptional()
@IsString()
@MaxLength(100)
addon_author?: string;
@ApiPropertyOptional({ description: '插件官网', example: 'https://www.niucloud.com' })
@IsOptional()
@IsString()
addon_url?: string;
@ApiPropertyOptional({ description: '排序', example: 0 })
@IsOptional()
@IsInt()
addon_sort?: number;
}
export class QueryAddonDto {
@ApiPropertyOptional({ description: '页码', example: 1 })
@IsOptional()
@IsInt()
page?: number;
@ApiPropertyOptional({ description: '每页数量', example: 20 })
@IsOptional()
@IsInt()
limit?: number;
@ApiPropertyOptional({ description: '关键词搜索', example: 'wechat' })
@IsOptional()
@IsString()
keyword?: string;
@ApiPropertyOptional({ description: '状态筛选', example: 1 })
@IsOptional()
@IsInt()
addon_status?: number;
@ApiPropertyOptional({ description: '是否安装', example: 1 })
@IsOptional()
@IsInt()
is_install?: number;
}