aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth/oauth-token.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-08 14:58:21 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 15:22:58 +0200
commite69219184b1a3262ec5e617d30337b6431c9840c (patch)
tree959b32e1ed28047052604941870563e946be9de1 /server/models/oauth/oauth-token.ts
parent6b09aba90dfe4c61331b66b1a6ef1f58ddc61485 (diff)
downloadPeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.gz
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.zst
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.zip
Implement user blocking on server side
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)