diff options
Diffstat (limited to 'server/models/oauth-token-interface.ts')
-rw-r--r-- | server/models/oauth-token-interface.ts | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/server/models/oauth-token-interface.ts b/server/models/oauth-token-interface.ts deleted file mode 100644 index 88526697e..000000000 --- a/server/models/oauth-token-interface.ts +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import * as Bluebird from 'bluebird' | ||
3 | |||
4 | import { UserModel } from './user-interface' | ||
5 | |||
6 | export type OAuthTokenInfo = { | ||
7 | refreshToken: string | ||
8 | refreshTokenExpiresAt: Date, | ||
9 | client: { | ||
10 | id: number | ||
11 | }, | ||
12 | user: { | ||
13 | id: number | ||
14 | } | ||
15 | } | ||
16 | |||
17 | export namespace OAuthTokenMethods { | ||
18 | export type GetByRefreshTokenAndPopulateClient = (refreshToken: string) => Bluebird<OAuthTokenInfo> | ||
19 | export type GetByTokenAndPopulateUser = (bearerToken: string) => Bluebird<OAuthTokenInstance> | ||
20 | export type GetByRefreshTokenAndPopulateUser = (refreshToken: string) => Bluebird<OAuthTokenInstance> | ||
21 | |||
22 | export type RemoveByUserIdCallback = (err: Error) => void | ||
23 | export type RemoveByUserId = (userId, callback) => void | ||
24 | } | ||
25 | |||
26 | export interface OAuthTokenClass { | ||
27 | getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient | ||
28 | getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser | ||
29 | getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser | ||
30 | removeByUserId: OAuthTokenMethods.RemoveByUserId | ||
31 | } | ||
32 | |||
33 | export interface OAuthTokenAttributes { | ||
34 | accessToken: string | ||
35 | accessTokenExpiresAt: Date | ||
36 | refreshToken: string | ||
37 | refreshTokenExpiresAt: Date | ||
38 | |||
39 | User?: UserModel | ||
40 | } | ||
41 | |||
42 | export interface OAuthTokenInstance extends OAuthTokenClass, OAuthTokenAttributes, Sequelize.Instance<OAuthTokenAttributes> { | ||
43 | id: number | ||
44 | createdAt: Date | ||
45 | updatedAt: Date | ||
46 | } | ||
47 | |||
48 | export interface OAuthTokenModel extends OAuthTokenClass, Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes> {} | ||