aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r--server/models/utils.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts
index c468f748d..1e168d419 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -117,6 +117,16 @@ function getInstanceFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'A
117 return getSort(value, lastSort) 117 return getSort(value, lastSort)
118} 118}
119 119
120function getChannelSyncSort (value: string): OrderItem[] {
121 const { direction, field } = buildDirectionAndField(value)
122 if (field.toLowerCase() === 'videochannel') {
123 return [
124 [ literal('"VideoChannel.name"'), direction ]
125 ]
126 }
127 return [ [ field, direction ] ]
128}
129
120function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { 130function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {
121 if (!model.createdAt || !model.updatedAt) { 131 if (!model.createdAt || !model.updatedAt) {
122 throw new Error('Miss createdAt & updatedAt attributes to model') 132 throw new Error('Miss createdAt & updatedAt attributes to model')
@@ -280,6 +290,7 @@ export {
280 getAdminUsersSort, 290 getAdminUsersSort,
281 getVideoSort, 291 getVideoSort,
282 getBlacklistSort, 292 getBlacklistSort,
293 getChannelSyncSort,
283 createSimilarityAttribute, 294 createSimilarityAttribute,
284 throwIfNotValid, 295 throwIfNotValid,
285 buildServerIdsFollowedBy, 296 buildServerIdsFollowedBy,