import * as Sequelize from 'sequelize'
-
-import { getSort, addMethodsToModel } from '../utils'
+import { hasUserRight, USER_ROLE_LABELS, UserRight } from '../../../shared'
import {
- cryptPassword,
comparePassword,
+ cryptPassword,
+ isUserDisplayNSFWValid,
isUserPasswordValid,
+ isUserRoleValid,
isUserUsernameValid,
- isUserDisplayNSFWValid,
- isUserVideoQuotaValid,
- isUserRoleValid
+ isUserVideoQuotaValid
} from '../../helpers'
-import { UserRight, USER_ROLE_LABELS, hasUserRight } from '../../../shared'
-
-import {
- UserInstance,
- UserAttributes,
-
- UserMethods
-} from './user-interface'
+import { addMethodsToModel, getSort } from '../utils'
+import { UserAttributes, UserInstance, UserMethods } from './user-interface'
let User: Sequelize.Model<UserInstance, UserAttributes>
let isPasswordMatch: UserMethods.IsPasswordMatch
roleLabel: USER_ROLE_LABELS[this.role],
videoQuota: this.videoQuota,
createdAt: this.createdAt,
- author: {
+ account: {
id: this.Account.id,
uuid: this.Account.uuid
}
'(SELECT MAX("VideoFiles"."size") AS "size" FROM "VideoFiles" ' +
'INNER JOIN "Videos" ON "VideoFiles"."videoId" = "Videos"."id" ' +
'INNER JOIN "VideoChannels" ON "VideoChannels"."id" = "Videos"."channelId" ' +
- 'INNER JOIN "Accounts" ON "VideoChannels"."authorId" = "Accounts"."id" ' +
+ 'INNER JOIN "Accounts" ON "VideoChannels"."accountId" = "Accounts"."id" ' +
'INNER JOIN "Users" ON "Accounts"."userId" = "Users"."id" ' +
'WHERE "Users"."id" = $userId GROUP BY "Videos"."id") t'