Sequelize queries #234

Merged
bones7242 merged 10 commits from sequelize-queries into master 2017-11-03 16:35:42 +01:00
2 changed files with 3 additions and 4 deletions
Showing only changes of commit e48a7b596d - Show all commits

View file

@ -153,10 +153,10 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, ARRAY, DECIMAL, D
where: { where: {
name : channelName, name : channelName,
claimId: { claimId: {
[Op.like]: `${channelId}%`, [sequelize.Op.like]: `${channelId}%`,
}, },
order: [['height', 'ASC']],
}, },
order: [['height', 'ASC']],
}) })
.then(result => { .then(result => {
switch (result.length) { switch (result.length) {

View file

@ -250,7 +250,6 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, ARRAY, DECIMAL, D
}); });
}; };
// sequelize.query(`SELECT claimId FROM Claim WHERE name = '${name}' AND claimId LIKE '${shortId}%' ORDER BY height ASC LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT })
Claim.getLongClaimIdFromShortClaimId = function (name, shortId) { Claim.getLongClaimIdFromShortClaimId = function (name, shortId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this this
@ -258,7 +257,7 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, ARRAY, DECIMAL, D
where: { where: {
name, name,
claimId: { claimId: {
[Op.like]: `${shortId}%`, [sequelize.Op.like]: `${shortId}%`,
}}, }},
order: [['height', 'ASC']], order: [['height', 'ASC']],
}) })