fixed error in certificate validation

This commit is contained in:
bill bittner 2017-11-27 18:21:50 -08:00
parent 4d2cf09f37
commit fe49f7e7de
2 changed files with 7 additions and 11 deletions

View file

@ -177,15 +177,10 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
where: {name, claimId}, where: {name, claimId},
}) })
.then(result => { .then(result => {
switch (result.length) { if (!result) {
case 0:
return resolve(NO_CHANNEL); return resolve(NO_CHANNEL);
case 1: };
return resolve(result[0]); resolve(claimId);
default:
logger.warn(`more than one entry matches that name (${name}) and certificate Id (${claimId})`);
return resolve(result[0]);
}
}) })
.catch(error => { .catch(error => {
reject(error); reject(error);

View file

@ -310,9 +310,10 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
where: { name, claimId }, where: { name, claimId },
}) })
.then(result => { .then(result => {
switch (result.length) { if (!result) {
case 0:
return resolve(null); return resolve(null);
};
switch (result.length) {
case 1: case 1:
return resolve(result[0]); return resolve(result[0]);
default: default: