add bundle

This commit is contained in:
Travis Eden 2018-10-31 09:01:15 -04:00
parent a4b02b9f4b
commit 74d9c6ac36

View file

@ -864,19 +864,29 @@ var claimQueries = (db, table, sequelize) => ({
}); });
}, },
getAllChannelClaims: async (channelClaimId) => { getAllChannelClaims: async (channelClaimId, bidState) => {
logger$1.debug(`claim.getAllChannelClaims for ${channelClaimId}`); logger$1.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
const whereClause = bidState || {
[sequelize.Op.or]: [
{ bid_state: 'Controlling' },
{ bid_state: 'Active' },
{ bid_state: 'Accepted' },
],
};
const selectWhere = {
...whereClause,
publisher_id: channelClaimId,
};
return await table.findAll({ return await table.findAll({
where: { publisher_id: channelClaimId }, where: selectWhere,
order: [['height', 'DESC']], order: [['height', 'DESC']],
}) })
.then(channelClaimsArray => { .then(channelClaimsArray => {
if(channelClaimsArray.length === 0) { if (channelClaimsArray.length === 0) {
return null; return null;
} }
return channelClaimsArray;
return channelClaimsArray; });
})
}, },
getClaimIdByLongChannelId: async (channelClaimId, claimName) => { getClaimIdByLongChannelId: async (channelClaimId, claimName) => {