소스 검색

refactor: streamline constructor and method signatures in VideoController; add secondTags property to UpdateVideoMediaTagsDto

Dave 1 개월 전
부모
커밋
c16f2edf42

+ 7 - 15
apps/box-app-api/src/feature/video/video.controller.ts

@@ -44,9 +44,7 @@ interface RequestWithUser extends Request {
 @ApiTags('视频')
 @Controller('video')
 export class VideoController {
-  constructor(private readonly videoService: VideoService
-  ) {}
-  
+  constructor(private readonly videoService: VideoService) {}
 
   /**
    * GET /api/v1/video/search
@@ -64,9 +62,7 @@ export class VideoController {
     type: VideoItemDto,
     isArray: true,
   })
-  async search(
-    @Body() req: VideoListRequestDto,
-  ): Promise<VideoItemDto[]> {
+  async search(@Body() req: VideoListRequestDto): Promise<VideoItemDto[]> {
     return await this.videoService.getVideoList(req);
   }
 
@@ -84,13 +80,11 @@ export class VideoController {
     description: '标签+视频',
     isArray: true,
   })
-  async homeVideo(
-    @Query('channelId') channelId: string,
-  ): Promise<any[]> {
+  async homeVideo(@Query('channelId') channelId: string): Promise<any[]> {
     return await this.videoService.getHomeSectionVideos(channelId);
-  }  
+  }
 
-@Get('guess')
+  @Get('guess')
   @ApiOperation({
     summary: '猜你喜欢',
   })
@@ -104,11 +98,9 @@ export class VideoController {
     description: '视频',
     isArray: true,
   })
-  async guess(
-    @Query('tag') tag: string,
-  ): Promise<any[]> {
+  async guess(@Query('tag') tag: string): Promise<any[]> {
     return await this.videoService.getGuessLikeVideos(tag);
-  }    
+  }
 
   /**
    * GET /api/v1/video/latest

+ 1 - 12
apps/box-mgnt-api/src/mgnt-backend/feature/provider-video-sync/provider-video-sync.service.ts

@@ -537,6 +537,7 @@ export class ProviderVideoSyncService {
       param,
     };
   }
+
   private async fetchPage(
     apiUrl: string,
     body: {
@@ -832,18 +833,6 @@ export class ProviderVideoSyncService {
       .filter((tag) => !!tag && !newlineSpam.test(tag) && !timestamp.test(tag));
   }
 
-  // Example:
-  // sanitizeSecondTags([
-  //   'MISSAV-最近更新',
-  //   '1:07:03\n ... 1:04:05',
-  //   'OL',
-  //   '恋物癖',
-  //   '偷拍',
-  //   '单体作品',
-  //   '自慰',
-  //   '高清',
-  // ]) // -> ['MISSAV-最近更新','OL','恋物癖','偷拍','单体作品','自慰','高清']
-
   private async upsertOne(record: any): Promise<UpsertOutcome> {
     const id = record?.id as string | undefined;
     if (!id) return { ok: false, error: { error: 'Missing id' } };

+ 9 - 0
apps/box-mgnt-api/src/mgnt-backend/feature/video-media/video-media.dto.ts

@@ -122,6 +122,15 @@ export class UpdateVideoMediaTagsDto {
   @ValidateNested({ each: true })
   @Type(() => VideoTagItemDto)
   tags!: VideoTagItemDto[];
+
+  @ApiProperty({
+    type: [String],
+    description: '原始 secondTags(必传,可为空数组)',
+    example: [],
+  })
+  @IsArray()
+  @IsString({ each: true })
+  secondTags!: string[];
 }
 
 export class UpdateVideoMediaStatusDto {