aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-19 14:55:58 +0200
committerChocobozzz <me@florianbigard.com>2019-06-19 15:05:36 +0200
commit3caf77d3b11f2dbc12e52d665183d36604c1dab9 (patch)
tree53e08727d5f1dc8be2bd4f4a14dadc05f607a9fb /server/models/utils.ts
parentbbe078ba55be635b5fc92f8f6286c45792b9e7e5 (diff)
downloadPeerTube-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.ts12
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 @@
1import { Sequelize } from 'sequelize-typescript' 1import { Model, Sequelize } from 'sequelize-typescript'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { OrderItem } from 'sequelize'
4import { Col } from 'sequelize/types/lib/utils' 3import { Col } from 'sequelize/types/lib/utils'
4import { OrderItem } from 'sequelize/types'
5 5
6type SortType = { sortModel: any, sortValue: string } 6type 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
130const createSafeIn = (model: typeof Model, stringArr: string[]) => {
131 return stringArr.map(t => model.sequelize.escape(t))
132 .join(', ')
133}
134
130// --------------------------------------------------------------------------- 135// ---------------------------------------------------------------------------
131 136
132export { 137export {
@@ -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// ---------------------------------------------------------------------------