update bid_state filter #668
1 changed files with 12 additions and 5 deletions
|
@ -63,12 +63,19 @@ export default (db, table, sequelize) => ({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getAllChannelClaims: async (channelClaimId, bidState = 'Controlling') => {
|
getAllChannelClaims: async (channelClaimId, bidState) => {
|
||||||
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
logger.debug(`claim.getAllChannelClaims for ${channelClaimId}`);
|
||||||
const selectWhere = {publisher_id: channelClaimId};
|
const whereClause = bidState || {
|
||||||
if (bidState) {
|
[sequelize.Op.or]: [
|
||||||
selectWhere.bid_state = bidState;
|
{ bid_state: 'Controlling' },
|
||||||
}
|
{ bid_state: 'Active' },
|
||||||
|
{ bid_state: 'Accepted' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const selectWhere = {
|
||||||
|
...whereClause,
|
||||||
|
publisher_id: channelClaimId,
|
||||||
|
};
|
||||||
return await table.findAll({
|
return await table.findAll({
|
||||||
where: selectWhere,
|
where: selectWhere,
|
||||||
order: [['height', 'DESC']],
|
order: [['height', 'DESC']],
|
||||||
|
|
Loading…
Reference in a new issue