aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth/oauth-token.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-23 17:36:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit39445ead45aaaea801ec09991b8dd2464f722e47 (patch)
tree9306c6b89115dabdd4a7c31a59784134a0e1c804 /server/models/oauth/oauth-token.ts
parent16b90975941b78d01d7202d441bf731a10048c16 (diff)
downloadPeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.tar.gz
PeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.tar.zst
PeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.zip
Cleanup models
Diffstat (limited to 'server/models/oauth/oauth-token.ts')
-rw-r--r--server/models/oauth/oauth-token.ts22
1 files changed, 2 insertions, 20 deletions
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts
index c7afcc38c..a82bff130 100644
--- a/server/models/oauth/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -3,19 +3,12 @@ import * as Sequelize from 'sequelize'
3import { logger } from '../../helpers' 3import { logger } from '../../helpers'
4 4
5import { addMethodsToModel } from '../utils' 5import { addMethodsToModel } from '../utils'
6import { 6import { OAuthTokenAttributes, OAuthTokenInfo, OAuthTokenInstance, OAuthTokenMethods } from './oauth-token-interface'
7 OAuthTokenInstance,
8 OAuthTokenAttributes,
9
10 OAuthTokenMethods,
11 OAuthTokenInfo
12} from './oauth-token-interface'
13 7
14let OAuthToken: Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes> 8let OAuthToken: Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes>
15let getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient 9let getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient
16let getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser 10let getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
17let getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser 11let getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
18let removeByUserId: OAuthTokenMethods.RemoveByUserId
19 12
20export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { 13export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
21 OAuthToken = sequelize.define<OAuthTokenInstance, OAuthTokenAttributes>('OAuthToken', 14 OAuthToken = sequelize.define<OAuthTokenInstance, OAuthTokenAttributes>('OAuthToken',
@@ -62,8 +55,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
62 55
63 getByRefreshTokenAndPopulateClient, 56 getByRefreshTokenAndPopulateClient,
64 getByTokenAndPopulateUser, 57 getByTokenAndPopulateUser,
65 getByRefreshTokenAndPopulateUser, 58 getByRefreshTokenAndPopulateUser
66 removeByUserId
67 ] 59 ]
68 addMethodsToModel(OAuthToken, classMethods) 60 addMethodsToModel(OAuthToken, classMethods)
69 61
@@ -170,13 +162,3 @@ getByRefreshTokenAndPopulateUser = function (refreshToken: string) {
170 return token 162 return token
171 }) 163 })
172} 164}
173
174removeByUserId = function (userId: number) {
175 const query = {
176 where: {
177 userId: userId
178 }
179 }
180
181 return OAuthToken.destroy(query)
182}