aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-22 20:58:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-25 17:32:16 +0200
commite02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch)
treeb7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/models/oauth-token-interface.ts
parent65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff)
downloadPeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz
PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst
PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip
Type models
Diffstat (limited to 'server/models/oauth-token-interface.ts')
-rw-r--r--server/models/oauth-token-interface.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/models/oauth-token-interface.ts b/server/models/oauth-token-interface.ts
new file mode 100644
index 000000000..a0cd1ffe7
--- /dev/null
+++ b/server/models/oauth-token-interface.ts
@@ -0,0 +1,34 @@
1import * as Sequelize from 'sequelize'
2
3import { UserModel } from './user-interface'
4
5export namespace OAuthTokenMethods {
6 export type GetByRefreshTokenAndPopulateClient = (refreshToken) => void
7 export type GetByTokenAndPopulateUser = (bearerToken) => void
8 export type GetByRefreshTokenAndPopulateUser = (refreshToken) => any
9 export type RemoveByUserId = (userId, callback) => void
10}
11
12export interface OAuthTokenClass {
13 getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient
14 getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
15 getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
16 removeByUserId: OAuthTokenMethods.RemoveByUserId
17}
18
19export interface OAuthTokenAttributes {
20 accessToken: string
21 accessTokenExpiresAt: Date
22 refreshToken: string
23 refreshTokenExpiresAt: Date
24
25 User?: UserModel
26}
27
28export interface OAuthTokenInstance extends OAuthTokenClass, OAuthTokenAttributes, Sequelize.Instance<OAuthTokenAttributes> {
29 id: number
30 createdAt: Date
31 updatedAt: Date
32}
33
34export interface OAuthTokenModel extends OAuthTokenClass, Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes> {}