diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-23 14:10:17 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-06-23 16:00:49 +0200 |
commit | 67ed6552b831df66713bac9e672738796128d33f (patch) | |
tree | 59c97d41e0b49d75a90aa3de987968ab9b1ff447 /server/models/utils.ts | |
parent | 0c4bacbff53bc732f5a2677d62a6ead7752e2405 (diff) | |
download | PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.gz PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.zst PeerTube-67ed6552b831df66713bac9e672738796128d33f.zip |
Reorganize client shared modules
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index 88c9b4adb..d706d9ea8 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -3,23 +3,6 @@ import validator from 'validator' | |||
3 | import { Col } from 'sequelize/types/lib/utils' | 3 | import { Col } from 'sequelize/types/lib/utils' |
4 | import { literal, OrderItem, Op } from 'sequelize' | 4 | import { literal, OrderItem, Op } from 'sequelize' |
5 | 5 | ||
6 | type Primitive = string | Function | number | boolean | Symbol | undefined | null | ||
7 | type DeepOmitHelper<T, K extends keyof T> = { | ||
8 | [P in K]: // extra level of indirection needed to trigger homomorhic behavior | ||
9 | T[P] extends infer TP // distribute over unions | ||
10 | ? TP extends Primitive | ||
11 | ? TP // leave primitives and functions alone | ||
12 | : TP extends any[] | ||
13 | ? DeepOmitArray<TP, K> // Array special handling | ||
14 | : DeepOmit<TP, K> | ||
15 | : never | ||
16 | } | ||
17 | type DeepOmit<T, K> = T extends Primitive ? T : DeepOmitHelper<T, Exclude<keyof T, K>> | ||
18 | |||
19 | type DeepOmitArray<T extends any[], K> = { | ||
20 | [P in keyof T]: DeepOmit<T[P], K> | ||
21 | } | ||
22 | |||
23 | type SortType = { sortModel: string, sortValue: string } | 6 | type SortType = { sortModel: string, sortValue: string } |
24 | 7 | ||
25 | // Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] | 8 | // Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] |
@@ -217,7 +200,6 @@ function searchAttribute (sourceField?: string, targetField?: string) { | |||
217 | // --------------------------------------------------------------------------- | 200 | // --------------------------------------------------------------------------- |
218 | 201 | ||
219 | export { | 202 | export { |
220 | DeepOmit, | ||
221 | buildBlockedAccountSQL, | 203 | buildBlockedAccountSQL, |
222 | buildLocalActorIdsIn, | 204 | buildLocalActorIdsIn, |
223 | SortType, | 205 | SortType, |