aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-05 22:09:16 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-05 22:09:16 +0200
commit5c98d3bf078852043cbdd582c01e3dc4f4b5b79f (patch)
tree303d57ecc3c5d7b73cbbeb7187986a3dab87bcf0 /server/models/user
parent8094a8980265a0a28e508dbd7cf7c7029e6d98b6 (diff)
downloadPeerTube-5c98d3bf078852043cbdd582c01e3dc4f4b5b79f.tar.gz
PeerTube-5c98d3bf078852043cbdd582c01e3dc4f4b5b79f.tar.zst
PeerTube-5c98d3bf078852043cbdd582c01e3dc4f4b5b79f.zip
Begin tests for user quota
Diffstat (limited to 'server/models/user')
-rw-r--r--server/models/user/user.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index 12a7547f5..9bf13ad24 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -244,7 +244,7 @@ loadByUsernameOrEmail = function (username: string, email: string) {
244function getOriginalVideoFileTotalFromUser (user: UserInstance) { 244function getOriginalVideoFileTotalFromUser (user: UserInstance) {
245 const query = { 245 const query = {
246 attributes: [ 246 attributes: [
247 Sequelize.fn('COUNT', Sequelize.col('VideoFile.size'), 'totalVideoBytes') 247 Sequelize.fn('COUNT', Sequelize.col('User.Author.Video.VideoFile.size'), 'totalVideoBytes')
248 ], 248 ],
249 where: { 249 where: {
250 id: user.id 250 id: user.id
@@ -252,12 +252,15 @@ function getOriginalVideoFileTotalFromUser (user: UserInstance) {
252 include: [ 252 include: [
253 { 253 {
254 model: User['sequelize'].models.Author, 254 model: User['sequelize'].models.Author,
255 required: true,
255 include: [ 256 include: [
256 { 257 {
257 model: User['sequelize'].models.Video, 258 model: User['sequelize'].models.Video,
259 required: true,
258 include: [ 260 include: [
259 { 261 {
260 model: User['sequelize'].models.VideoFile 262 model: User['sequelize'].models.VideoFile,
263 required: true
261 } 264 }
262 ] 265 ]
263 } 266 }