Преглед на файлове

fix(video): align controller/service with wudi_dev

Dave преди 1 месец
родител
ревизия
c95723675f
променени са 2 файла, в които са добавени 0 реда и са изтрити 19 реда
  1. 0 2
      apps/box-app-api/src/feature/video/video.controller.ts
  2. 0 17
      apps/box-app-api/src/feature/video/video.service.ts

+ 0 - 2
apps/box-app-api/src/feature/video/video.controller.ts

@@ -57,8 +57,6 @@ export class VideoController {
   @ApiOperation({
     summary: '搜索视频',
     description: '',
-    summary: '搜索视频',
-    description: '',
   })
   @ApiResponse({
     status: 200,

+ 0 - 17
apps/box-app-api/src/feature/video/video.service.ts

@@ -37,7 +37,6 @@ import {
 } from '../homepage/homepage.constants';
 import { CategoryDto } from '../homepage/dto/homepage.dto';
 import { VideoListItemDto } from './dto/video-list-response.dto';
-import { VideoListItemDto } from './dto/video-list-response.dto';
 
 /**
  * VideoService provides read-only access to video data from Redis cache.
@@ -110,9 +109,6 @@ export class VideoService {
     const cacheKey = `video:list:${Buffer.from(
       JSON.stringify(dto),
     ).toString('base64')}`;
-    const cacheKey = `video:list:${Buffer.from(
-      JSON.stringify(dto),
-    ).toString('base64')}`;
 
     if(!ttl){
       ttl = random ? 15 : 300;
@@ -175,8 +171,6 @@ export class VideoService {
           orderBy: [{ addedTime: 'desc' }, { createdAt: 'desc' }],
           skip: start,
           take: size,
-          skip: start,
-          take: size,
           select: {
             id: true,
             title: true,
@@ -186,13 +180,10 @@ export class VideoService {
             preFileName: true,
           },
         })) as VideoListItemDto[];
-        })) as VideoListItemDto[];
       }
 
       if (fallbackRecords.length > 0) {
         await this.redis.setJson(cacheKey, fallbackRecords, ttl);
-      if (fallbackRecords.length > 0) {
-        await this.redis.setJson(cacheKey, fallbackRecords, ttl);
       }
 
       return fallbackRecords;
@@ -203,14 +194,6 @@ export class VideoService {
       );
       return [];
     }
-      return fallbackRecords;
-    } catch (err) {
-      this.logger.error(
-        `Error fetching videos from MongoDB`,
-        err instanceof Error ? err.stack : String(err),
-      );
-      return [];
-    }
   }
 
   /**