Skip to content

Commit

Permalink
refactor: oauth-client module and repository use new jwt service
Browse files Browse the repository at this point in the history
  • Loading branch information
supalarry committed Jan 3, 2024
1 parent a057d06 commit d213820
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions apps/api/v2/src/modules/oauth-clients/oauth-client.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getEnv } from "@/env";
import { AuthModule } from "@/modules/auth/auth.module";
import { MembershipsModule } from "@/modules/memberships/memberships.module";
import { OAuthClientUsersController } from "@/modules/oauth-clients/controllers/oauth-client-users/oauth-client-users.controller";
Expand All @@ -11,17 +10,10 @@ import { PrismaModule } from "@/modules/prisma/prisma.module";
import { TokensRepository } from "@/modules/tokens/tokens.repository";
import { UsersModule } from "@/modules/users/users.module";
import { Global, Module } from "@nestjs/common";
import { JwtModule } from "@nestjs/jwt";

@Global()
@Module({
imports: [
PrismaModule,
AuthModule,
UsersModule,
MembershipsModule,
JwtModule.register({ secret: getEnv("JWT_SECRET") }),
],
imports: [PrismaModule, AuthModule, UsersModule, MembershipsModule],
providers: [OAuthClientRepository, OAuthClientCredentialsGuard, TokensRepository, OAuthFlowService],
controllers: [OAuthClientUsersController, OAuthClientsController, OAuthFlowController],
exports: [OAuthClientRepository, OAuthClientCredentialsGuard],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JwtService } from "@/modules/jwt/jwt.service";
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
import { Injectable } from "@nestjs/common";
import { JwtService } from "@nestjs/jwt";
import type { PlatformOAuthClient } from "@prisma/client";

import type { CreateOAuthClientInput } from "@calcom/platform-types";
Expand All @@ -18,7 +18,7 @@ export class OAuthClientRepository {
return this.dbWrite.prisma.platformOAuthClient.create({
data: {
...data,
secret: await this.jwtService.signAsync(JSON.stringify(data)),
secret: this.jwtService.sign(data),
organizationId,
},
});
Expand Down

0 comments on commit d213820

Please sign in to comment.