]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
Fix update host script
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
index 1401762c5c4da81023a55c321a599b992940995d..8f7c9b01338a1e13e354766f8ef231a5ec3b0007 100644 (file)
@@ -1,23 +1,16 @@
 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
@@ -164,7 +157,7 @@ toFormattedJSON = function (this: UserInstance) {
     roleLabel: USER_ROLE_LABELS[this.role],
     videoQuota: this.videoQuota,
     createdAt: this.createdAt,
-    author: {
+    account: {
       id: this.Account.id,
       uuid: this.Account.uuid
     }
@@ -295,7 +288,7 @@ function getOriginalVideoFileTotalFromUser (user: UserInstance) {
                 '(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'