|
|
@@ -1,5 +1,6 @@
|
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
import {
|
|
|
+ IsArray,
|
|
|
IsInt,
|
|
|
IsMongoId,
|
|
|
IsNotEmpty,
|
|
|
@@ -7,10 +8,33 @@ import {
|
|
|
IsString,
|
|
|
IsUrl,
|
|
|
MaxLength,
|
|
|
+ ValidateNested,
|
|
|
} from 'class-validator';
|
|
|
import { Transform, Type } from 'class-transformer';
|
|
|
import { PageListDto } from '@box/common/dto/page-list.dto';
|
|
|
|
|
|
+// DTO for category reference
|
|
|
+export class CategoryRefDto {
|
|
|
+ @ApiProperty({ description: 'Category ID (MySQL auto-increment)' })
|
|
|
+ @IsString()
|
|
|
+ id: string;
|
|
|
+
|
|
|
+ @ApiProperty({ description: 'Category name' })
|
|
|
+ @IsString()
|
|
|
+ name: string;
|
|
|
+}
|
|
|
+
|
|
|
+// DTO for tag reference
|
|
|
+export class TagRefDto {
|
|
|
+ @ApiProperty({ description: 'Tag ID (MySQL auto-increment)' })
|
|
|
+ @IsString()
|
|
|
+ id: string;
|
|
|
+
|
|
|
+ @ApiProperty({ description: 'Tag name' })
|
|
|
+ @IsString()
|
|
|
+ name: string;
|
|
|
+}
|
|
|
+
|
|
|
export class ChannelDto {
|
|
|
@ApiProperty({
|
|
|
description: '渠道ID (Mongo ObjectId)',
|
|
|
@@ -91,6 +115,30 @@ export class ChannelDto {
|
|
|
@Type(() => Number)
|
|
|
@IsInt()
|
|
|
updateAt: number;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '片库分类',
|
|
|
+ type: [CategoryRefDto],
|
|
|
+ example: [{ id: '507f1f77bcf86cd799439011', name: '场景剧情' }],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ categories?: CategoryRefDto[] | null;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '首页推荐标签',
|
|
|
+ type: [TagRefDto],
|
|
|
+ example: [{ id: '507f1f77bcf86cd799439012', name: '无码' }],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ tags?: TagRefDto[] | null;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '标签名称数组(用于搜索优化)',
|
|
|
+ type: [String],
|
|
|
+ example: ['无码', '中文字幕'],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ tagNames?: string[];
|
|
|
}
|
|
|
|
|
|
export class CreateChannelDto {
|
|
|
@@ -167,12 +215,36 @@ export class CreateChannelDto {
|
|
|
@MaxLength(500)
|
|
|
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
|
|
|
remark?: string;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '片库分类',
|
|
|
+ type: [CategoryRefDto],
|
|
|
+ example: [{ id: '507f1f77bcf86cd799439011', name: '场景剧情' }],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ categories?: CategoryRefDto[] | null;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '首页推荐标签',
|
|
|
+ type: [TagRefDto],
|
|
|
+ example: [{ id: '507f1f77bcf86cd799439012', name: '无码' }],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ tags?: TagRefDto[] | null;
|
|
|
+
|
|
|
+ @ApiPropertyOptional({
|
|
|
+ description: '标签名称数组(用于搜索优化)',
|
|
|
+ type: [String],
|
|
|
+ example: ['无码', '中文字幕'],
|
|
|
+ })
|
|
|
+ @IsOptional()
|
|
|
+ tagNames?: string[];
|
|
|
}
|
|
|
|
|
|
export class UpdateChannelDto extends CreateChannelDto {
|
|
|
- @ApiProperty({ description: '渠道ID (ObjectId)' })
|
|
|
- @IsMongoId()
|
|
|
- id: string;
|
|
|
+ // Note: id comes from path parameter, not body
|
|
|
+ // Internal use only - set by controller
|
|
|
+ id?: string;
|
|
|
}
|
|
|
|
|
|
export class ListChannelDto extends PageListDto {
|