Migrate connected account model (#2944)

* migrate-connectedAccount-model

* update accountOwerId

* prevent user from connecting multiple times with the same account

* Delete .yarn/releases/yarn-1.22.21.cjs

* Delete .yarnrc

* modified according to comments

* updates
This commit is contained in:
bosiraphael
2023-12-12 11:09:20 +01:00
committed by GitHub
parent 3f422f9640
commit 95002f5f9a
8 changed files with 113 additions and 96 deletions
@@ -28,21 +28,22 @@ export class GoogleGmailAuthController {
@Req() req: GoogleGmailRequest,
@Res() res: Response,
) {
const { user: gmailUser } = req;
const { user } = req;
const { accessToken, refreshToken, transientToken } = gmailUser;
const { email, accessToken, refreshToken, transientToken } = user;
const { workspaceMemberId, workspaceId } =
await this.tokenService.verifyTransientToken(transientToken);
this.googleGmailService.saveConnectedAccount({
email,
workspaceMemberId: workspaceMemberId,
workspaceId: workspaceId,
type: 'gmail',
provider: 'gmail',
accessToken,
refreshToken,
});
return res.redirect('http://localhost:3001');
return res.redirect('http://localhost:3001/settings/accounts');
}
}