Skip to content

Commit 540c3e5

Browse files
committed
Fix Op.lie
1 parent 29ea84f commit 540c3e5

File tree

7 files changed

+26
-15303
lines changed

7 files changed

+26
-15303
lines changed

controllers/web/admins.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const models = require('../../models/models.js');
22
const debug = require('debug')('idm:web-admin_controller');
33
const gravatar = require('gravatar');
4+
const Sequelize = require('sequelize');
5+
const Op = Sequelize.Op;
46

57
// See if user is administrator
68
exports.is_admin = function (req, res, next) {
@@ -27,7 +29,7 @@ exports.admin_users = function (req, res) {
2729
where: {
2830
admin: true,
2931
username: {
30-
like: '%' + key + '%'
32+
[Op.like]: '%' + key + '%'
3133
}
3234
},
3335
attributes: ['id', 'email', 'username', 'image', 'gravatar'],

controllers/web/authorize_org_apps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ exports.available_organizations = function (req, res) {
114114
attributes: ['name', 'id', 'image'],
115115
where: {
116116
name: {
117-
like: '%' + key + '%'
117+
[Op.like]: '%' + key + '%'
118118
}
119119
}
120120
})

controllers/web/authorize_user_apps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ exports.available_users = function (req, res) {
117117
attributes: ['username', 'id', 'image'],
118118
where: {
119119
username: {
120-
like: '%' + key + '%'
120+
[Op.like]: '%' + key + '%'
121121
}
122122
}
123123
})

controllers/web/organizations.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const models = require('../../models/models.js');
22
const debug = require('debug')('idm:web-organization_controller');
33
const gravatar = require('gravatar');
44
const fs = require('fs');
5+
const Sequelize = require('sequelize');
6+
const Op = Sequelize.Op;
57

68
const image = require('../../lib/image.js');
79

@@ -289,7 +291,7 @@ exports.get_members = function (req, res) {
289291
include: [
290292
{
291293
model: models.user,
292-
where: req.query.key ? { username: { like: '%' + req.query.key + '%' } } : {},
294+
where: req.query.key ? { username: { [Op.like]: '%' + req.query.key + '%' } } : {},
293295
attributes: ['id', 'username', 'image', 'gravatar', 'email']
294296
}
295297
],

controllers/web/trusted_apps.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const models = require('../../models/models.js');
2+
const Sequelize = require('sequelize');
3+
const Op = Sequelize.Op;
24

35
const debug = require('debug')('idm:web-trusted_apps_controller');
46

@@ -105,7 +107,7 @@ exports.available_applications = function (req, res) {
105107
attributes: ['name', 'id', 'image'],
106108
where: {
107109
name: {
108-
like: '%' + key + '%'
110+
[Op.like]: '%' + key + '%'
109111
}
110112
}
111113
})

models/model_oauth_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ function trusted_applications(app_id) {
888888

889889
return models.trusted_application
890890
.findAll({
891-
where: { oauth_client_id: app_id },
891+
where: { oauth_client_id: { [Op.is]: app_id } },
892892
attributes: ['trusted_oauth_client_id']
893893
})
894894
.then(function (trusted_apps) {

0 commit comments

Comments
 (0)