Browse Source

login return ads

FC_DAN\c9837 1 tháng trước cách đây
mục cha
commit
1d5d614b86

+ 2 - 0
apps/box-app-api/src/feature/auth/auth.module.ts

@@ -9,12 +9,14 @@ import { AuthService } from './auth.service';
 import { CoreModule } from '@box/core/core.module';
 import { JwtStrategy } from './strategies/jwt.strategy';
 import { JwtAuthGuard } from './guards/jwt-auth.guard';
+import { AdModule } from '../ads/ad.module';
 
 @Module({
   imports: [
     PrismaMongoModule,
     RabbitmqModule,
     CoreModule,
+    AdModule,
     PassportModule.register({ defaultStrategy: 'jwt' }),
     JwtModule.registerAsync({
       imports: [ConfigModule],

+ 3 - 1
apps/box-app-api/src/feature/auth/auth.service.ts

@@ -5,6 +5,7 @@ import { nowSecBigInt } from '@box/common/time/time.util';
 import { RabbitmqPublisherService } from '../../rabbitmq/rabbitmq-publisher.service';
 import { PrismaMongoStatsService } from '../../prisma/prisma-mongo-stats.service';
 import { PrismaMongoService } from '../../prisma/prisma-mongo.service';
+import { AdService } from '../ads/ad.service';
 
 type LoginParams = {
   uid: string;
@@ -30,6 +31,7 @@ export class AuthService {
     private readonly rabbitmqPublisher: RabbitmqPublisherService,
     private readonly prismaMongoStatsService: PrismaMongoStatsService,
     private readonly prismaMongoService: PrismaMongoService, // box-admin
+    private readonly adService: AdService,
   ) {}
 
   async login(params: LoginParams): Promise<LoginResult> {
@@ -99,7 +101,7 @@ export class AuthService {
 
     // 5) startupAds (placeholder: you’ll wire channel-specific ads later)
     // For now return null to keep behaviour deterministic.
-    const startupAds: any | null = null;
+    const startupAds = await this.adService.listAdsByType(1, 20);
 
     return {
       uid,