Merge pull request #638 from lbryio/controlling-claims-only
filter claims by bid_state: 'Controlling'
This commit is contained in:
commit
1bebde8137
1 changed files with 12 additions and 9 deletions
|
@ -63,19 +63,22 @@ export default (db, table, sequelize) => ({
|
|||
});
|
||||
},
|
||||
|
||||
getAllChannelClaims: async (channelClaimId) => {
|
||||
getAllChannelClaims: async (channelClaimId, bidState = 'Controlling') => {
|
||||
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
||||
const selectWhere = {publisher_id: channelClaimId};
|
||||
if (bidState) {
|
||||
selectWhere.bid_state = bidState;
|
||||
}
|
||||
return await table.findAll({
|
||||
where: { publisher_id: channelClaimId },
|
||||
where: selectWhere,
|
||||
order: [['height', 'DESC']],
|
||||
})
|
||||
.then(channelClaimsArray => {
|
||||
if(channelClaimsArray.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return channelClaimsArray;
|
||||
})
|
||||
.then(channelClaimsArray => {
|
||||
if (channelClaimsArray.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return channelClaimsArray;
|
||||
});
|
||||
},
|
||||
|
||||
getClaimIdByLongChannelId: async (channelClaimId, claimName) => {
|
||||
|
|
Loading…
Reference in a new issue