aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth/oauth-token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/oauth/oauth-token.ts')
-rw-r--r--server/models/oauth/oauth-token.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts
index 026c30135..4c53848dc 100644
--- a/server/models/oauth/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -3,6 +3,7 @@ import { logger } from '../../helpers/logger'
3import { AccountModel } from '../account/account' 3import { AccountModel } from '../account/account'
4import { UserModel } from '../account/user' 4import { UserModel } from '../account/user'
5import { OAuthClientModel } from './oauth-client' 5import { OAuthClientModel } from './oauth-client'
6import { Transaction } from 'sequelize'
6 7
7export type OAuthTokenInfo = { 8export type OAuthTokenInfo = {
8 refreshToken: string 9 refreshToken: string
@@ -125,7 +126,7 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> {
125 } as OAuthTokenInfo 126 } as OAuthTokenInfo
126 }) 127 })
127 .catch(err => { 128 .catch(err => {
128 logger.info('getRefreshToken error.', { err }) 129 logger.error('getRefreshToken error.', { err })
129 throw err 130 throw err
130 }) 131 })
131 } 132 }
@@ -163,11 +164,12 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> {
163 }) 164 })
164 } 165 }
165 166
166 static deleteUserToken (userId: number) { 167 static deleteUserToken (userId: number, t?: Transaction) {
167 const query = { 168 const query = {
168 where: { 169 where: {
169 userId 170 userId
170 } 171 },
172 transaction: t
171 } 173 }
172 174
173 return OAuthTokenModel.destroy(query) 175 return OAuthTokenModel.destroy(query)