Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: added cus

Nevo David8dcfffff53ae
diff --git a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts
index fe18a8cba..e3acf6c1f 100644
--- a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts
@@ -165,6 +165,14 @@ export class OAuthRepository {
exchangeCodeForToken(id: string, encryptedToken: string) {
return this._oauthAuth.model.oAuthAuthorization.update({
where: { id },
+ select: {
+ organizationId: true,
+ organization: {
+ select: {
+ paymentId: true,
+ }
+ }
+ },
data: {
accessToken: encryptedToken,
authorizationCode: null,
diff --git a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts
index 610b424ce..2a1033dd4 100644
--- a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts
@@ -138,13 +138,17 @@ export class OAuthService {
const token = 'pos_' + makeId(40);
const encryptedToken = AuthService.fixedEncryption(token);
- const { organizationId } = await this._oauthRepository.exchangeCodeForToken(
+ const {
+ organizationId,
+ organization: { paymentId },
+ } = await this._oauthRepository.exchangeCodeForToken(
auth.id,
encryptedToken
);
return {
id: organizationId,
+ cus: paymentId,
access_token: token,
token_type: 'bearer',
};