diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-19 14:55:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-19 15:05:36 +0200 |
commit | 3caf77d3b11f2dbc12e52d665183d36604c1dab9 (patch) | |
tree | 53e08727d5f1dc8be2bd4f4a14dadc05f607a9fb /server/models/utils.ts | |
parent | bbe078ba55be635b5fc92f8f6286c45792b9e7e5 (diff) | |
download | PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.tar.gz PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.tar.zst PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.zip |
Add language filters in user preferences
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index 2b172f608..206e108c3 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Sequelize } from 'sequelize-typescript' | 1 | import { Model, Sequelize } from 'sequelize-typescript' |
2 | import * as validator from 'validator' | 2 | import * as validator from 'validator' |
3 | import { OrderItem } from 'sequelize' | ||
4 | import { Col } from 'sequelize/types/lib/utils' | 3 | import { Col } from 'sequelize/types/lib/utils' |
4 | import { OrderItem } from 'sequelize/types' | ||
5 | 5 | ||
6 | type SortType = { sortModel: any, sortValue: string } | 6 | type SortType = { sortModel: any, sortValue: string } |
7 | 7 | ||
@@ -127,6 +127,11 @@ function parseAggregateResult (result: any) { | |||
127 | return total | 127 | return total |
128 | } | 128 | } |
129 | 129 | ||
130 | const createSafeIn = (model: typeof Model, stringArr: string[]) => { | ||
131 | return stringArr.map(t => model.sequelize.escape(t)) | ||
132 | .join(', ') | ||
133 | } | ||
134 | |||
130 | // --------------------------------------------------------------------------- | 135 | // --------------------------------------------------------------------------- |
131 | 136 | ||
132 | export { | 137 | export { |
@@ -141,7 +146,8 @@ export { | |||
141 | buildTrigramSearchIndex, | 146 | buildTrigramSearchIndex, |
142 | buildWhereIdOrUUID, | 147 | buildWhereIdOrUUID, |
143 | isOutdated, | 148 | isOutdated, |
144 | parseAggregateResult | 149 | parseAggregateResult, |
150 | createSafeIn | ||
145 | } | 151 | } |
146 | 152 | ||
147 | // --------------------------------------------------------------------------- | 153 | // --------------------------------------------------------------------------- |