aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/utils.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-20 11:20:12 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commit0251197e249cc03b65805ed6805da72bf4573529 (patch)
tree3aae202fd1ea24bac5cd7f2c380ffe50aae189a0 /server/models/utils.ts
parentb8cf27c0f86d205a279d03b83e0e6728f46da67f (diff)
downloadPeerTube-0251197e249cc03b65805ed6805da72bf4573529.tar.gz
PeerTube-0251197e249cc03b65805ed6805da72bf4573529.tar.zst
PeerTube-0251197e249cc03b65805ed6805da72bf4573529.zip
Factorize rest-table and fix/simplify SQL
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r--server/models/utils.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 7137419a2..bdf2291f0 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -208,13 +208,15 @@ function buildDirectionAndField (value: string) {
208} 208}
209 209
210function searchAttribute (sourceField, targetField) { 210function searchAttribute (sourceField, targetField) {
211 return sourceField 211 if (sourceField) {
212 ? { 212 return {
213 [targetField]: { 213 [targetField]: {
214 [Op.iLike]: `%${sourceField}%` 214 [Op.iLike]: `%${sourceField}%`
215 } 215 }
216 } 216 }
217 : {} 217 } else {
218 return {}
219 }
218} 220}
219 221
220// --------------------------------------------------------------------------- 222// ---------------------------------------------------------------------------