Skip to content

Commit

Permalink
Merge pull request #190 from starknet-id/ayush/claimed-status-fix
Browse files Browse the repository at this point in the history
feat: removed claimed status from boost query
  • Loading branch information
Th0rgal authored Feb 9, 2024
2 parents 474dfef + f05ad26 commit 2bd0e1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
35 changes: 0 additions & 35 deletions src/endpoints/quest_boost/get_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use futures::StreamExt;
use mongodb::bson::doc;
use serde::Deserialize;
use std::sync::Arc;

#[derive(Deserialize)]
pub struct GetQuestsQuery {
id: u32,
Expand All @@ -30,40 +29,6 @@ pub async fn handler(
"id": query.id
}
},
doc! {
"$lookup": doc! {
"from": "boost_claims",
"localField": "id",
"foreignField": "id",
"as": "claim_detail"
}
},
doc! {
"$addFields": doc! {
"claimed": doc! {
"$anyElementTrue": doc! {
"$map": doc! {
"input": "$claim_detail",
"as": "claimDetail",
"in": doc! {
"$eq": [
doc! {
"$ifNull": [
"$$claimDetail._cursor.to",
null
]
},
null
]
}
}
}
}
},
},
doc! {
"$unset": "claim_detail"
},
doc! {
"$project":{
"_id":0
Expand Down
16 changes: 12 additions & 4 deletions src/endpoints/quest_boost/get_pending_claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ pub async fn handler(
let collection = state.db.collection::<QuestDocument>("boosts");
let pipeline = [
doc! {
"$match": {
"winner":address
"$unwind": doc! {
"path": "$winner"
}
},
doc! {
"$match": doc! {
"winner": address,
}
},
doc! {
Expand All @@ -56,7 +61,10 @@ pub async fn handler(
]
},
doc! {
"$in": ["$$localWinner","$winner"],
"$eq": [
"$winner",
"$$localWinner"
]
},
doc! {
"$eq": [
Expand Down Expand Up @@ -88,7 +96,7 @@ pub async fn handler(
"$project": doc! {
"_id": 0,
"boost_claims": 0,
"hidden":0
"hidden": 0
}
},
];
Expand Down

0 comments on commit 2bd0e1e

Please sign in to comment.