diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-08-25 11:45:31 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-08-25 11:45:31 +0200 |
commit | 0aef76c479bc7fc758e70e1cd478ade46761b51b (patch) | |
tree | ed59eae3ee731c56d25cc35a382f4cc400d0dece /server/models/user | |
parent | 93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 (diff) | |
download | PeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.tar.gz PeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.tar.zst PeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.zip |
Formated -> Formatted
Diffstat (limited to 'server/models/user')
-rw-r--r-- | server/models/user/user-interface.ts | 8 | ||||
-rw-r--r-- | server/models/user/user.ts | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.ts index 9bd3d2ebb..0b97a8f6d 100644 --- a/server/models/user/user-interface.ts +++ b/server/models/user/user-interface.ts | |||
@@ -2,14 +2,14 @@ import * as Sequelize from 'sequelize' | |||
2 | import * as Promise 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 { User as FormatedUser } from '../../../shared/models/users/user.model' | 5 | import { User as FormattedUser } from '../../../shared/models/users/user.model' |
6 | import { UserRole } from '../../../shared/models/users/user-role.type' | 6 | import { UserRole } from '../../../shared/models/users/user-role.type' |
7 | import { ResultList } from '../../../shared/models/result-list.model' | 7 | import { ResultList } from '../../../shared/models/result-list.model' |
8 | 8 | ||
9 | export namespace UserMethods { | 9 | export namespace UserMethods { |
10 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> | 10 | export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> |
11 | 11 | ||
12 | export type ToFormatedJSON = (this: UserInstance) => FormatedUser | 12 | export type ToFormattedJSON = (this: UserInstance) => FormattedUser |
13 | export type IsAdmin = (this: UserInstance) => boolean | 13 | export type IsAdmin = (this: UserInstance) => boolean |
14 | 14 | ||
15 | export type CountTotal = () => Promise<number> | 15 | export type CountTotal = () => Promise<number> |
@@ -29,7 +29,7 @@ export namespace UserMethods { | |||
29 | 29 | ||
30 | export interface UserClass { | 30 | export interface UserClass { |
31 | isPasswordMatch: UserMethods.IsPasswordMatch, | 31 | isPasswordMatch: UserMethods.IsPasswordMatch, |
32 | toFormatedJSON: UserMethods.ToFormatedJSON, | 32 | toFormattedJSON: UserMethods.ToFormattedJSON, |
33 | isAdmin: UserMethods.IsAdmin, | 33 | isAdmin: UserMethods.IsAdmin, |
34 | 34 | ||
35 | countTotal: UserMethods.CountTotal, | 35 | countTotal: UserMethods.CountTotal, |
@@ -55,7 +55,7 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.Insta | |||
55 | updatedAt: Date | 55 | updatedAt: Date |
56 | 56 | ||
57 | isPasswordMatch: UserMethods.IsPasswordMatch | 57 | isPasswordMatch: UserMethods.IsPasswordMatch |
58 | toFormatedJSON: UserMethods.ToFormatedJSON | 58 | toFormattedJSON: UserMethods.ToFormattedJSON |
59 | isAdmin: UserMethods.IsAdmin | 59 | isAdmin: UserMethods.IsAdmin |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index bda95d2f6..e1b933988 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -21,7 +21,7 @@ import { | |||
21 | 21 | ||
22 | let User: Sequelize.Model<UserInstance, UserAttributes> | 22 | let User: Sequelize.Model<UserInstance, UserAttributes> |
23 | let isPasswordMatch: UserMethods.IsPasswordMatch | 23 | let isPasswordMatch: UserMethods.IsPasswordMatch |
24 | let toFormatedJSON: UserMethods.ToFormatedJSON | 24 | let toFormattedJSON: UserMethods.ToFormattedJSON |
25 | let isAdmin: UserMethods.IsAdmin | 25 | let isAdmin: UserMethods.IsAdmin |
26 | let countTotal: UserMethods.CountTotal | 26 | let countTotal: UserMethods.CountTotal |
27 | let getByUsername: UserMethods.GetByUsername | 27 | let getByUsername: UserMethods.GetByUsername |
@@ -108,7 +108,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
108 | ] | 108 | ] |
109 | const instanceMethods = [ | 109 | const instanceMethods = [ |
110 | isPasswordMatch, | 110 | isPasswordMatch, |
111 | toFormatedJSON, | 111 | toFormattedJSON, |
112 | isAdmin | 112 | isAdmin |
113 | ] | 113 | ] |
114 | addMethodsToModel(User, classMethods, instanceMethods) | 114 | addMethodsToModel(User, classMethods, instanceMethods) |
@@ -129,7 +129,7 @@ isPasswordMatch = function (this: UserInstance, password: string) { | |||
129 | return comparePassword(password, this.password) | 129 | return comparePassword(password, this.password) |
130 | } | 130 | } |
131 | 131 | ||
132 | toFormatedJSON = function (this: UserInstance) { | 132 | toFormattedJSON = function (this: UserInstance) { |
133 | return { | 133 | return { |
134 | id: this.id, | 134 | id: this.id, |
135 | username: this.username, | 135 | username: this.username, |