diff options
Diffstat (limited to 'server/models/user/user-interface.ts')
-rw-r--r-- | server/models/user/user-interface.ts | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.ts index 48c67678b..f743945f8 100644 --- a/server/models/user/user-interface.ts +++ b/server/models/user/user-interface.ts | |||
@@ -1,35 +1,29 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Bluebird from 'bluebird' | 2 | import * as Promise from 'bluebird' |
3 | 3 | ||
4 | // Don't use barrel, import just what we need | 4 | // Don't use barrel, import just what we need |
5 | import { UserRole, User as FormatedUser } from '../../../shared/models/user.model' | 5 | import { UserRole, User as FormatedUser } from '../../../shared/models/user.model' |
6 | import { ResultList } from '../../../shared/models/result-list.model' | ||
6 | 7 | ||
7 | export namespace UserMethods { | 8 | export namespace UserMethods { |
8 | export type IsPasswordMatchCallback = (err: Error, same: boolean) => void | 9 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> |
9 | export type IsPasswordMatch = (this: UserInstance, password: string, callback: IsPasswordMatchCallback) => void | ||
10 | 10 | ||
11 | export type ToFormatedJSON = (this: UserInstance) => FormatedUser | 11 | export type ToFormatedJSON = (this: UserInstance) => FormatedUser |
12 | export type IsAdmin = (this: UserInstance) => boolean | 12 | export type IsAdmin = (this: UserInstance) => boolean |
13 | 13 | ||
14 | export type CountTotalCallback = (err: Error, total: number) => void | 14 | export type CountTotal = () => Promise<number> |
15 | export type CountTotal = (callback: CountTotalCallback) => void | ||
16 | 15 | ||
17 | export type GetByUsername = (username: string) => Bluebird<UserInstance> | 16 | export type GetByUsername = (username: string) => Promise<UserInstance> |
18 | 17 | ||
19 | export type ListCallback = (err: Error, userInstances: UserInstance[]) => void | 18 | export type List = () => Promise<UserInstance[]> |
20 | export type List = (callback: ListCallback) => void | ||
21 | 19 | ||
22 | export type ListForApiCallback = (err: Error, userInstances?: UserInstance[], total?: number) => void | 20 | export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<UserInstance> > |
23 | export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void | ||
24 | 21 | ||
25 | export type LoadByIdCallback = (err: Error, userInstance: UserInstance) => void | 22 | export type LoadById = (id: number) => Promise<UserInstance> |
26 | export type LoadById = (id: number, callback: LoadByIdCallback) => void | ||
27 | 23 | ||
28 | export type LoadByUsernameCallback = (err: Error, userInstance: UserInstance) => void | 24 | export type LoadByUsername = (username: string) => Promise<UserInstance> |
29 | export type LoadByUsername = (username: string, callback: LoadByUsernameCallback) => void | ||
30 | 25 | ||
31 | export type LoadByUsernameOrEmailCallback = (err: Error, userInstance: UserInstance) => void | 26 | export type LoadByUsernameOrEmail = (username: string, email: string) => Promise<UserInstance> |
32 | export type LoadByUsernameOrEmail = (username: string, email: string, callback: LoadByUsernameOrEmailCallback) => void | ||
33 | } | 27 | } |
34 | 28 | ||
35 | export interface UserClass { | 29 | export interface UserClass { |