aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user-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/user-interface.ts
parent15a302943d84bc0978b84fe33110c4daa451d311 (diff)
downloadPeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz
PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst
PeerTube-74889a71fe687dda74f2a687653122327807af36.zip
Reorganize model files
Diffstat (limited to 'server/models/user-interface.ts')
-rw-r--r--server/models/user-interface.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/server/models/user-interface.ts b/server/models/user-interface.ts
deleted file mode 100644
index 98963b743..000000000
--- a/server/models/user-interface.ts
+++ /dev/null
@@ -1,63 +0,0 @@
1import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird'
3
4// Don't use barrel, import just what we need
5import { User as FormatedUser } from '../../shared/models/user.model'
6
7export namespace UserMethods {
8 export type IsPasswordMatchCallback = (err: Error, same: boolean) => void
9 export type IsPasswordMatch = (password: string, callback: IsPasswordMatchCallback) => void
10
11 export type ToFormatedJSON = () => FormatedUser
12 export type IsAdmin = () => boolean
13
14 export type CountTotalCallback = (err: Error, total: number) => void
15 export type CountTotal = (callback: CountTotalCallback) => void
16
17 export type GetByUsername = (username: string) => Bluebird<UserInstance>
18
19 export type ListCallback = (err: Error, userInstances: UserInstance[]) => void
20 export type List = (callback: ListCallback) => void
21
22 export type ListForApiCallback = (err: Error, userInstances?: UserInstance[], total?: number) => void
23 export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
24
25 export type LoadByIdCallback = (err: Error, userInstance: UserInstance) => void
26 export type LoadById = (id: number, callback: LoadByIdCallback) => void
27
28 export type LoadByUsernameCallback = (err: Error, userInstance: UserInstance) => void
29 export type LoadByUsername = (username: string, callback: LoadByUsernameCallback) => void
30
31 export type LoadByUsernameOrEmailCallback = (err: Error, userInstance: UserInstance) => void
32 export type LoadByUsernameOrEmail = (username: string, email: string, callback: LoadByUsernameOrEmailCallback) => void
33}
34
35export interface UserClass {
36 isPasswordMatch: UserMethods.IsPasswordMatch,
37 toFormatedJSON: UserMethods.ToFormatedJSON,
38 isAdmin: UserMethods.IsAdmin,
39
40 countTotal: UserMethods.CountTotal,
41 getByUsername: UserMethods.GetByUsername,
42 list: UserMethods.List,
43 listForApi: UserMethods.ListForApi,
44 loadById: UserMethods.LoadById,
45 loadByUsername: UserMethods.LoadByUsername,
46 loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail
47}
48
49export interface UserAttributes {
50 password: string
51 username: string
52 email: string
53 displayNSFW?: boolean
54 role: string
55}
56
57export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> {
58 id: number
59 createdAt: Date
60 updatedAt: Date
61}
62
63export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}