aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
commit74889a71fe687dda74f2a687653122327807af36 (patch)
treee938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/oauth-token-interface.ts
parent15a302943d84bc0978b84fe33110c4daa451d311 (diff)
downloadPeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz
PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst
PeerTube-74889a71fe687dda74f2a687653122327807af36.zip
Reorganize model files
Diffstat (limited to 'server/models/oauth-token-interface.ts')
-rw-r--r--server/models/oauth-token-interface.ts48
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 @@
1import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird'
3
4import { UserModel } from './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) => 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
26export interface OAuthTokenClass {
27 getByRefreshTokenAndPopulateClient: OAuthTokenMethods.GetByRefreshTokenAndPopulateClient
28 getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
29 getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
30 removeByUserId: OAuthTokenMethods.RemoveByUserId
31}
32
33export interface OAuthTokenAttributes {
34 accessToken: string
35 accessTokenExpiresAt: Date
36 refreshToken: string
37 refreshTokenExpiresAt: Date
38
39 User?: UserModel
40}
41
42export interface OAuthTokenInstance extends OAuthTokenClass, OAuthTokenAttributes, Sequelize.Instance<OAuthTokenAttributes> {
43 id: number
44 createdAt: Date
45 updatedAt: Date
46}
47
48export interface OAuthTokenModel extends OAuthTokenClass, Sequelize.Model<OAuthTokenInstance, OAuthTokenAttributes> {}