aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth/oauth-token-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/models/oauth/oauth-token-interface.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
Diffstat (limited to 'server/models/oauth/oauth-token-interface.ts')
-rw-r--r--server/models/oauth/oauth-token-interface.ts46
1 files changed, 0 insertions, 46 deletions
diff --git a/server/models/oauth/oauth-token-interface.ts b/server/models/oauth/oauth-token-interface.ts
deleted file mode 100644
index 47d95d5fc..000000000
--- a/server/models/oauth/oauth-token-interface.ts
+++ /dev/null
@@ -1,46 +0,0 @@
1import * as Promise from 'bluebird'
2import * as Sequelize from 'sequelize'
3
4import { UserModel } from '../account/user-interface'
5
6export type OAuthTokenInfo = {
7 refreshToken: string
8 refreshTokenExpiresAt: Date,
9 client: {
10 id: number
11 },
12 user: {
13 id: number
14 }
15}
16
17export namespace OAuthTokenMethods {
18 export type GetByRefreshTokenAndPopulateClient = (refreshToken: string) => Promise<OAuthTokenInfo>
19 export type GetByTokenAndPopulateUser = (bearerToken: string) => Promise<OAuthTokenInstance>
20 export type GetByRefreshTokenAndPopulateUser = (refreshToken: string) => Promise<OAuthTokenInstance>
21}
22
23export interface OAuthTokenClass {
24 getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient
25 getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
26 getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
27}
28
29export interface OAuthTokenAttributes {
30 accessToken: string
31 accessTokenExpiresAt: Date
32 refreshToken: string
33 refreshTokenExpiresAt: Date
34
35 userId?: number
36 oAuthClientId?: number
37 User?: UserModel
38}
39
40export interface OAuthTokenInstance extends OAuthTokenClass, OAuthTokenAttributes, Sequelize.Instance<OAuthTokenAttributes> {
41 id: number
42 createdAt: Date
43 updatedAt: Date
44}
45
46export interface OAuthTokenModel extends OAuthTokenClass, Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes> {}