Răsfoiți Sursa

feat(auth): add channel info retrieval in login result

Dave 1 lună în urmă
părinte
comite
a96cab50b3
1 a modificat fișierele cu 18 adăugiri și 0 ștergeri
  1. 18 0
      apps/box-app-api/src/feature/auth/auth.service.ts

+ 18 - 0
apps/box-app-api/src/feature/auth/auth.service.ts

@@ -21,6 +21,7 @@ type LoginParams = {
 type LoginResult = {
   uid: string;
   channelId: string;
+  channel: any;
   startupAds: any | null; // keep as any until you wire your Ad payload DTO
   conf: any | null;
 };
@@ -111,6 +112,7 @@ export class AuthService {
     return {
       uid,
       channelId: finalChannelId,
+      channel: await this.getChannleInfo(finalChannelId),
       startupAds,
       conf,
     };
@@ -180,6 +182,22 @@ export class AuthService {
   // Channel resolution (box-admin)
   // ---------------------------
 
+  // get channel info and return channelId, landingUrl, videoCdn, coverCdn, clientName, clientNotice
+  private async getChannleInfo(channelId: string): Promise<any> {
+    const channel = await this.prismaMongoService.channel.findUnique({
+      where: { channelId },
+      select: {
+        channelId: true,
+        landingUrl: true,
+        videoCdn: true,
+        coverCdn: true,
+        clientName: true,
+        clientNotice: true,
+      },
+    });
+    return channel;
+  }
+
   private async resolveFirstLoginChannel(
     channelIdInput?: string,
   ): Promise<any> {