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}`);
|
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
||||||
|
const selectWhere = {publisher_id: channelClaimId};
|
||||||
|
if (bidState) {
|
||||||
|
selectWhere.bid_state = bidState;
|
||||||
|
}
|
||||||
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) => {
|
||||||
|
|
Loading…
Reference in a new issue