Merge pull request #672 from lbryio/bidstate-bundle

add bundle
This commit is contained in:
Travis Eden 2018-10-31 09:02:28 -04:00 committed by GitHub
commit 0e4353e66c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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) => {