aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-08 14:30:29 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-09 11:41:22 +0100
commitb49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch)
treea2825877d7b3b53454804a79c9d2a14c5d37385c /server/models/oauth
parent6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff)
downloadPeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip
Upgrade sequelize to v6
Diffstat (limited to 'server/models/oauth')
-rw-r--r--server/models/oauth/oauth-client.ts2
-rw-r--r--server/models/oauth/oauth-token.ts17
2 files changed, 9 insertions, 10 deletions
diff --git a/server/models/oauth/oauth-client.ts b/server/models/oauth/oauth-client.ts
index 42c59bb79..8dbc1c2f5 100644
--- a/server/models/oauth/oauth-client.ts
+++ b/server/models/oauth/oauth-client.ts
@@ -14,7 +14,7 @@ import { OAuthTokenModel } from './oauth-token'
14 } 14 }
15 ] 15 ]
16}) 16})
17export class OAuthClientModel extends Model<OAuthClientModel> { 17export class OAuthClientModel extends Model {
18 18
19 @AllowNull(false) 19 @AllowNull(false)
20 @Column 20 @Column
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts
index 7f2313dad..6bc6cf27c 100644
--- a/server/models/oauth/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -1,3 +1,4 @@
1import { Transaction } from 'sequelize'
1import { 2import {
2 AfterDestroy, 3 AfterDestroy,
3 AfterUpdate, 4 AfterUpdate,
@@ -11,15 +12,13 @@ import {
11 Table, 12 Table,
12 UpdatedAt 13 UpdatedAt
13} from 'sequelize-typescript' 14} from 'sequelize-typescript'
15import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
14import { logger } from '../../helpers/logger' 16import { logger } from '../../helpers/logger'
15import { UserModel } from '../account/user' 17import { clearCacheByToken } from '../../lib/oauth-model'
16import { OAuthClientModel } from './oauth-client'
17import { Transaction } from 'sequelize'
18import { AccountModel } from '../account/account' 18import { AccountModel } from '../account/account'
19import { UserModel } from '../account/user'
19import { ActorModel } from '../activitypub/actor' 20import { ActorModel } from '../activitypub/actor'
20import { clearCacheByToken } from '../../lib/oauth-model' 21import { OAuthClientModel } from './oauth-client'
21import * as Bluebird from 'bluebird'
22import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
23 22
24export type OAuthTokenInfo = { 23export type OAuthTokenInfo = {
25 refreshToken: string 24 refreshToken: string
@@ -80,7 +79,7 @@ enum ScopeNames {
80 } 79 }
81 ] 80 ]
82}) 81})
83export class OAuthTokenModel extends Model<OAuthTokenModel> { 82export class OAuthTokenModel extends Model {
84 83
85 @AllowNull(false) 84 @AllowNull(false)
86 @Column 85 @Column
@@ -174,7 +173,7 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> {
174 }) 173 })
175 } 174 }
176 175
177 static getByTokenAndPopulateUser (bearerToken: string): Bluebird<MOAuthTokenUser> { 176 static getByTokenAndPopulateUser (bearerToken: string): Promise<MOAuthTokenUser> {
178 const query = { 177 const query = {
179 where: { 178 where: {
180 accessToken: bearerToken 179 accessToken: bearerToken
@@ -190,7 +189,7 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> {
190 }) 189 })
191 } 190 }
192 191
193 static getByRefreshTokenAndPopulateUser (refreshToken: string): Bluebird<MOAuthTokenUser> { 192 static getByRefreshTokenAndPopulateUser (refreshToken: string): Promise<MOAuthTokenUser> {
194 const query = { 193 const query = {
195 where: { 194 where: {
196 refreshToken 195 refreshToken