diff options
Diffstat (limited to 'server/models/oauth')
-rw-r--r-- | server/models/oauth/oauth-client.ts | 2 | ||||
-rw-r--r-- | server/models/oauth/oauth-token.ts | 17 |
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 | }) |
17 | export class OAuthClientModel extends Model<OAuthClientModel> { | 17 | export 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 @@ | |||
1 | import { Transaction } from 'sequelize' | ||
1 | import { | 2 | import { |
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' |
15 | import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' | ||
14 | import { logger } from '../../helpers/logger' | 16 | import { logger } from '../../helpers/logger' |
15 | import { UserModel } from '../account/user' | 17 | import { clearCacheByToken } from '../../lib/oauth-model' |
16 | import { OAuthClientModel } from './oauth-client' | ||
17 | import { Transaction } from 'sequelize' | ||
18 | import { AccountModel } from '../account/account' | 18 | import { AccountModel } from '../account/account' |
19 | import { UserModel } from '../account/user' | ||
19 | import { ActorModel } from '../activitypub/actor' | 20 | import { ActorModel } from '../activitypub/actor' |
20 | import { clearCacheByToken } from '../../lib/oauth-model' | 21 | import { OAuthClientModel } from './oauth-client' |
21 | import * as Bluebird from 'bluebird' | ||
22 | import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' | ||
23 | 22 | ||
24 | export type OAuthTokenInfo = { | 23 | export type OAuthTokenInfo = { |
25 | refreshToken: string | 24 | refreshToken: string |
@@ -80,7 +79,7 @@ enum ScopeNames { | |||
80 | } | 79 | } |
81 | ] | 80 | ] |
82 | }) | 81 | }) |
83 | export class OAuthTokenModel extends Model<OAuthTokenModel> { | 82 | export 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 |