aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user-interface.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account/user-interface.ts')
-rw-r--r--server/models/account/user-interface.ts67
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 @@
1import * as Bluebird from 'bluebird'
2import * as Sequelize from 'sequelize'
3import { ResultList } from '../../../shared/models/result-list.model'
4import { UserRight } from '../../../shared/models/users/user-right.enum'
5import { UserRole } from '../../../shared/models/users/user-role'
6import { User as FormattedUser } from '../../../shared/models/users/user.model'
7import { AccountInstance } from './account-interface'
8
9export 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
30export 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
45export 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
57export 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
67export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}