diff options
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 | // --------------------------------------------------------------------------- |