Selaa lähdekoodia

refactor: update import statements and improve code formatting for consistency

Dave 1 kuukausi sitten
vanhempi
säilyke
0d19bb4dd9

+ 4 - 5
apps/box-app-api/src/feature/ads/ad-pool-cache-compat.util.ts

@@ -123,19 +123,18 @@ function normalizeLegacyEntry(entry: unknown): AdPoolEntry | null {
 
   return {
     id,
-    adType,
+    adType: adType as AdType,
     advertiser,
     title,
     adsContent:
       record.adsContent === undefined
         ? null
         : typeof record.adsContent === 'string'
-        ? record.adsContent
-        : String(record.adsContent),
+          ? record.adsContent
+          : String(record.adsContent),
     adsCoverImg:
       typeof record.adsCoverImg === 'string' ? record.adsCoverImg : null,
-    adsUrl:
-      typeof record.adsUrl === 'string' ? record.adsUrl : null,
+    adsUrl: typeof record.adsUrl === 'string' ? record.adsUrl : null,
     imgSource:
       typeof record.imgSource === 'string'
         ? (record.imgSource as AdPoolEntry['imgSource'])

+ 1 - 1
apps/box-app-api/src/feature/recommendation/dto/ad-recommendation.dto.ts

@@ -1,5 +1,5 @@
 import { ApiProperty } from '@nestjs/swagger';
-import type { AdType as PrismaAdType } from '@prisma/mongo/client';
+import { AdType as PrismaAdType } from '@prisma/mongo/client';
 
 export class AdRecommendationDto {
   @ApiProperty({

+ 1 - 1
apps/box-app-api/src/feature/recommendation/recommend-public.controller.ts

@@ -11,7 +11,7 @@ import {
   YouMayAlsoLikeVideoResponseDto,
   YouMayAlsoLikeAdResponseDto,
 } from './dto/enriched-recommendation.dto';
-import type { AdType as PrismaAdType } from '@prisma/mongo/client';
+import { AdType as PrismaAdType } from '@prisma/mongo/client';
 
 @ApiTags('推荐')
 @Controller('recommend')

+ 1 - 1
apps/box-app-api/src/feature/recommendation/recommendation.controller.ts

@@ -15,7 +15,7 @@ import {
   AdRecommendationDto,
   GetSimilarAdsResponseDto,
 } from './dto/ad-recommendation.dto';
-import type { AdType as PrismaAdType } from '@prisma/mongo/client';
+import { AdType as PrismaAdType } from '@prisma/mongo/client';
 
 @ApiTags('推荐系统')
 @Controller('api/v1/recommendation')

+ 1 - 0
libs/common/src/ads/ad-types.ts

@@ -55,4 +55,5 @@ export interface AdPoolEntry {
   startDt: bigint;
   expiryDt: bigint;
   seq: number;
+  trackingId?: string;
 }

+ 7 - 7
libs/core/src/cache/video/category/video-category-cache.builder.ts

@@ -4,7 +4,6 @@ import { BaseCacheBuilder } from '@box/common/cache/cache-builder';
 import { RedisService } from '@box/db/redis/redis.service';
 import { MongoPrismaService } from '@box/db/prisma/mongo-prisma.service';
 import { CacheKeys } from '@box/common/cache/cache-keys';
-import { CacheKeys } from '@box/common/cache/cache-keys';
 import { tsCacheKeys } from '@box/common/cache/ts-cache-key.provider';
 import {
   RawVideoPayloadRow,
@@ -407,10 +406,7 @@ export class VideoCategoryCacheBuilder extends BaseCacheBuilder {
     await this.buildCategoryVideoListForCategory(categoryId);
   }
 
-  async rebuildVideoTagCache(
-    categoryId: string,
-    tagId: string,
-  ): Promise<void> {
+  async rebuildVideoTagCache(categoryId: string, tagId: string): Promise<void> {
     await this.buildTagFilteredVideoListForTag(categoryId, tagId);
   }
 
@@ -488,7 +484,9 @@ export class VideoCategoryCacheBuilder extends BaseCacheBuilder {
     });
   }
 
-  private async fetchVideoById(videoId: string): Promise<RawVideoPayloadRow | null> {
+  private async fetchVideoById(
+    videoId: string,
+  ): Promise<RawVideoPayloadRow | null> {
     return this.mongoPrisma.videoMedia.findUnique({
       where: { id: videoId },
       select: {
@@ -511,7 +509,9 @@ export class VideoCategoryCacheBuilder extends BaseCacheBuilder {
     });
   }
 
-  private async writeVideoPayloads(videos: RawVideoPayloadRow[]): Promise<void> {
+  private async writeVideoPayloads(
+    videos: RawVideoPayloadRow[],
+  ): Promise<void> {
     if (!videos.length) return;
 
     const entries = videos.map((video) => ({