aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user-interface.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/user-interface.ts')
-rw-r--r--server/models/user-interface.ts45
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 @@
1import * as Sequelize from 'sequelize'
2
3export 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
17export 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
31export interface UserAttributes {
32 password: string
33 username: string
34 email: string
35 displayNSFW?: boolean
36 role: string
37}
38
39export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> {
40 id: number
41 createdAt: Date
42 updatedAt: Date
43}
44
45export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}