X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Futils.ts;h=5b4093aec40d7b2aee217810c437da749b167afd;hb=e0e665f0efa98f2701dd9f5529e99989680481ae;hp=60b0906e80964a4d5bf3e128dbd08b0b6289095e;hpb=be0f59b4eec3c2c4dcd151e2b174be39dff1568e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/utils.ts b/server/models/utils.ts index 60b0906e8..5b4093aec 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -29,7 +29,11 @@ function getVideoSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) { ] } - return [ [ field, direction ], lastSort ] + const firstSort = typeof field === 'string' ? + field.split('.').concat([ direction ]) : + [ field, direction ] + + return [ firstSort, lastSort ] } function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) {