Skip to content

Commit

Permalink
Merge pull request #40 from starknet-id/fix/error_not_enabled
Browse files Browse the repository at this point in the history
fix: handle duplicate domains
  • Loading branch information
Th0rgal authored Nov 9, 2023
2 parents 633a63d + f3bf2b4 commit 3efa7c7
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions bot/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,28 @@ pub async fn get_domains_ready_for_renewal(
"as": "approval_info",
}},
doc! { "$unwind": { "path": "$approval_info", "preserveNullAndEmptyArrays": true } },
doc! { "$group": {
"_id": "$domain",
"expiry": { "$first": "$expiry" },
"renewer_address": { "$first": "$renewal_info.renewer_address" },
"enabled": { "$first": "$renewal_info.enabled" },
"approval_value": { "$first": { "$ifNull": [ "$approval_info.allowance", "0x0" ] } },
"allowance": { "$first": "$renewal_info.allowance" },
"last_renewal": { "$first": "$renewal_info.last_renewal" },
"meta_hash": { "$first": "$renewal_info.meta_hash" },
"_cursor": { "$first": "$renewal_info._cursor" },
}},
doc! { "$project": {
"domain": 1,
"_id": 0,
"domain": "$_id",
"expiry": 1,
"renewer_address": "$renewal_info.renewer_address",
"enabled": "$renewal_info.enabled",
"approval_value": { "$ifNull": [ "$approval_info.allowance", "0x0" ] },
"allowance": "$renewal_info.allowance",
"last_renewal": "$renewal_info.last_renewal",
"meta_hash": "$renewal_info.meta_hash",
"_cursor": "$renewal_info._cursor",
"renewer_address": 1,
"enabled": 1,
"approval_value": 1,
"allowance": 1,
"last_renewal": 1,
"meta_hash": 1,
"_cursor": 1,
}},
];

Expand Down

0 comments on commit 3efa7c7

Please sign in to comment.