diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/models/user-interface.ts | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server/models/user-interface.ts')
-rw-r--r-- | server/models/user-interface.ts | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/server/models/user-interface.ts b/server/models/user-interface.ts new file mode 100644 index 000000000..a504f42a1 --- /dev/null +++ b/server/models/user-interface.ts | |||
@@ -0,0 +1,45 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | export namespace UserMethods { | ||
4 | export type IsPasswordMatch = (password, callback) => void | ||
5 | export type ToFormatedJSON = () => void | ||
6 | export type IsAdmin = () => boolean | ||
7 | |||
8 | export type CountTotal = (callback) => void | ||
9 | export type GetByUsername = (username) => any | ||
10 | export type List = (callback) => void | ||
11 | export type ListForApi = (start, count, sort, callback) => void | ||
12 | export type LoadById = (id, callback) => void | ||
13 | export type LoadByUsername = (username, callback) => void | ||
14 | export type LoadByUsernameOrEmail = (username, email, callback) => void | ||
15 | } | ||
16 | |||
17 | export interface UserClass { | ||
18 | isPasswordMatch: UserMethods.IsPasswordMatch, | ||
19 | toFormatedJSON: UserMethods.ToFormatedJSON, | ||
20 | isAdmin: UserMethods.IsAdmin, | ||
21 | |||
22 | countTotal: UserMethods.CountTotal, | ||
23 | getByUsername: UserMethods.GetByUsername, | ||
24 | list: UserMethods.List, | ||
25 | listForApi: UserMethods.ListForApi, | ||
26 | loadById: UserMethods.LoadById, | ||
27 | loadByUsername: UserMethods.LoadByUsername, | ||
28 | loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail | ||
29 | } | ||
30 | |||
31 | export interface UserAttributes { | ||
32 | password: string | ||
33 | username: string | ||
34 | email: string | ||
35 | displayNSFW?: boolean | ||
36 | role: string | ||
37 | } | ||
38 | |||
39 | export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> { | ||
40 | id: number | ||
41 | createdAt: Date | ||
42 | updatedAt: Date | ||
43 | } | ||
44 | |||
45 | export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {} | ||