diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/models/account/user-interface.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/models/account/user-interface.ts')
-rw-r--r-- | server/models/account/user-interface.ts | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/server/models/account/user-interface.ts b/server/models/account/user-interface.ts deleted file mode 100644 index 0f0b72063..000000000 --- a/server/models/account/user-interface.ts +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import * as Sequelize from 'sequelize' | ||
3 | import { ResultList } from '../../../shared/models/result-list.model' | ||
4 | import { UserRight } from '../../../shared/models/users/user-right.enum' | ||
5 | import { UserRole } from '../../../shared/models/users/user-role' | ||
6 | import { User as FormattedUser } from '../../../shared/models/users/user.model' | ||
7 | import { AccountInstance } from './account-interface' | ||
8 | |||
9 | export namespace UserMethods { | ||
10 | export type HasRight = (this: UserInstance, right: UserRight) => boolean | ||
11 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> | ||
12 | |||
13 | export type ToFormattedJSON = (this: UserInstance) => FormattedUser | ||
14 | export type IsAbleToUploadVideo = (this: UserInstance, videoFile: Express.Multer.File) => Promise<boolean> | ||
15 | |||
16 | export type CountTotal = () => Bluebird<number> | ||
17 | |||
18 | export type GetByUsername = (username: string) => Bluebird<UserInstance> | ||
19 | |||
20 | export type ListForApi = (start: number, count: number, sort: string) => Bluebird< ResultList<UserInstance> > | ||
21 | |||
22 | export type LoadById = (id: number) => Bluebird<UserInstance> | ||
23 | |||
24 | export type LoadByUsername = (username: string) => Bluebird<UserInstance> | ||
25 | export type LoadByUsernameAndPopulateChannels = (username: string) => Bluebird<UserInstance> | ||
26 | |||
27 | export type LoadByUsernameOrEmail = (username: string, email: string) => Bluebird<UserInstance> | ||
28 | } | ||
29 | |||
30 | export interface UserClass { | ||
31 | isPasswordMatch: UserMethods.IsPasswordMatch, | ||
32 | toFormattedJSON: UserMethods.ToFormattedJSON, | ||
33 | hasRight: UserMethods.HasRight, | ||
34 | isAbleToUploadVideo: UserMethods.IsAbleToUploadVideo, | ||
35 | |||
36 | countTotal: UserMethods.CountTotal, | ||
37 | getByUsername: UserMethods.GetByUsername, | ||
38 | listForApi: UserMethods.ListForApi, | ||
39 | loadById: UserMethods.LoadById, | ||
40 | loadByUsername: UserMethods.LoadByUsername, | ||
41 | loadByUsernameAndPopulateChannels: UserMethods.LoadByUsernameAndPopulateChannels, | ||
42 | loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail | ||
43 | } | ||
44 | |||
45 | export interface UserAttributes { | ||
46 | id?: number | ||
47 | password: string | ||
48 | username: string | ||
49 | email: string | ||
50 | displayNSFW?: boolean | ||
51 | role: UserRole | ||
52 | videoQuota: number | ||
53 | |||
54 | Account?: AccountInstance | ||
55 | } | ||
56 | |||
57 | export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> { | ||
58 | id: number | ||
59 | createdAt: Date | ||
60 | updatedAt: Date | ||
61 | |||
62 | isPasswordMatch: UserMethods.IsPasswordMatch | ||
63 | toFormattedJSON: UserMethods.ToFormattedJSON | ||
64 | hasRight: UserMethods.HasRight | ||
65 | } | ||
66 | |||
67 | export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {} | ||