Skip to content

Commit

Permalink
feat: add expiry timestamp updated query
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtom committed Apr 18, 2024
1 parent 22b7dc1 commit 32d8bd8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
7 changes: 0 additions & 7 deletions src/endpoints/analytics/get_quest_activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ pub async fn handler(
"expiry": "$_id.expiry"
},
"pipeline": [
doc! {
"$addFields": doc! {
"refactoredTimestamp": doc! {
"$toDate": "$timestamp"
}
}
},
doc! {
"$match": doc! {
"$expr": doc! {
Expand Down
7 changes: 0 additions & 7 deletions src/endpoints/analytics/get_quest_participation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ pub async fn handler(
"expiry": "$_id.expiry"
},
"pipeline": [
doc! {
"$addFields": doc! {
"refactoredTimestamp": doc! {
"$toDate": "$timestamp"
}
}
},
doc! {
"$match": doc! {
"$expr": doc! {
Expand Down
33 changes: 25 additions & 8 deletions src/endpoints/quests/starknetid/verify_socials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ async fn call_contract_helper(
}

#[route(
get,
"/quests/starknetid/verify_socials",
crate::endpoints::quests::starknetid::verify_socials
get,
"/quests/starknetid/verify_socials",
crate::endpoints::quests::starknetid::verify_socials
)]
pub async fn handler(
State(state): State<Arc<AppState>>,
Expand All @@ -53,26 +53,39 @@ pub async fn handler(
) -> Result<(StatusCode, Json<serde_json::Value>), String> {
let task_id = 6;
let addr = &query.addr;

println!("addr {:?}", addr);
println!("naming_contract {:?}", state.conf.starknetid_contracts.naming_contract);
let domain_res = call_contract_helper(
&state,
state.conf.starknetid_contracts.naming_contract,
selector!("address_to_domain"),
vec![*addr],
)
.await?;
.await?;
println!("domain res {:?}", domain_res);

let id_res = call_contract_helper(
&state,
state.conf.starknetid_contracts.naming_contract,
selector!("domain_to_token_id"),
domain_res,
)
.await?;
.await?;

println!("id_res res {:?}", id_res);


let mut twitter = false;
let mut discord = false;

for verifier_contract in &state.conf.starknetid_contracts.verifier_contracts {
let calldata = vec![
id_res[0],
short_string!("discord"),
*verifier_contract,
FieldElement::ZERO,
];
println!("calldata : {:?}", calldata);
let twitter_verifier_data = call_contract_helper(
&state,
state.conf.starknetid_contracts.identity_contract,
Expand All @@ -84,7 +97,8 @@ pub async fn handler(
FieldElement::ZERO,
],
)
.await?;
.await?;
println!("twitter_verifier_data : {:?}", twitter_verifier_data);
if twitter_verifier_data[0] != felt!("0") {
twitter = true;
}
Expand All @@ -100,7 +114,10 @@ pub async fn handler(
FieldElement::ZERO,
],
)
.await?;
.await?;

println!("twitter_verifier_data : {:?}", discord_verifier_data);

if discord_verifier_data[0] != felt!("0") {
discord = true;
}
Expand Down

0 comments on commit 32d8bd8

Please sign in to comment.