From 5f92452756e1b3e3d50d90ca5ede0f948a78e6ab Mon Sep 17 00:00:00 2001 From: Poulav Bhowmick Date: Sat, 24 Aug 2024 20:03:11 +0530 Subject: [PATCH] Updated the axum_auto_routes --- .../batched/verify_tvl_batched.rs | 3 +- .../achievements/claim/quests_achievement.rs | 3 +- src/endpoints/achievements/fetch.rs | 3 +- src/endpoints/achievements/fetch_buildings.rs | 3 +- .../achievements/verify_achieved_quests.rs | 3 +- src/endpoints/achievements/verify_avnu.rs | 3 +- src/endpoints/achievements/verify_briq.rs | 3 +- src/endpoints/achievements/verify_default.rs | 3 +- .../achievements/verify_has_domain.rs | 4 +- src/endpoints/achievements/verify_quests.rs | 3 +- .../achievements/verify_seniority.rs | 3 +- src/endpoints/achievements/verify_tvl.rs | 3 +- src/endpoints/admin/balance/create_balance.rs | 3 +- src/endpoints/admin/balance/update_balance.rs | 3 +- src/endpoints/admin/custom/create_custom.rs | 3 +- src/endpoints/admin/custom/update_custom.rs | 2 +- src/endpoints/admin/delete_task.rs | 2 +- src/endpoints/admin/discord/create_discord.rs | 3 +- src/endpoints/admin/discord/update_discord.rs | 2 +- src/endpoints/admin/domain/create_domain.rs | 3 +- src/endpoints/admin/domain/update_domain.rs | 2 +- src/endpoints/admin/login.rs | 2 +- src/endpoints/admin/nft_uri/create_uri.rs | 2 +- src/endpoints/admin/nft_uri/get_nft_uri.rs | 3 +- src/endpoints/admin/nft_uri/update_uri.rs | 2 +- src/endpoints/admin/quest/create_quest.rs | 3 +- src/endpoints/admin/quest/get_quest.rs | 3 +- src/endpoints/admin/quest/get_quests.rs | 3 +- src/endpoints/admin/quest/get_tasks.rs | 2 +- src/endpoints/admin/quest/update_quest.rs | 2 +- .../admin/quest_boost/create_boost.rs | 3 +- .../admin/quest_boost/update_boost.rs | 3 +- src/endpoints/admin/quiz/create_question.rs | 3 +- src/endpoints/admin/quiz/create_quiz.rs | 3 +- src/endpoints/admin/quiz/get_quiz.rs | 3 +- src/endpoints/admin/quiz/update_question.rs | 3 +- src/endpoints/admin/quiz/update_quiz.rs | 2 +- .../admin/twitter/create_twitter_fw.rs | 3 +- .../admin/twitter/create_twitter_rw.rs | 3 +- .../admin/twitter/update_twitter_fw.rs | 3 +- .../admin/twitter/update_twitter_rw.rs | 2 +- src/endpoints/admin/user/create_user.rs | 2 +- src/endpoints/analytics/get_quest_activity.rs | 3 +- .../analytics/get_quest_participation.rs | 3 +- .../analytics/get_unique_visitors.rs | 3 +- .../discover/defi/get_alt_protocol_stats.rs | 2 +- .../discover/defi/get_derivatives_stats.rs | 2 +- src/endpoints/discover/defi/get_lend_stats.rs | 2 +- src/endpoints/discover/defi/get_pair_stats.rs | 2 +- src/endpoints/get_boosted_quests.rs | 2 +- src/endpoints/get_completed_quests.rs | 2 +- src/endpoints/get_deployed_time.rs | 2 +- src/endpoints/get_quest.rs | 2 +- src/endpoints/get_quest_category.rs | 2 +- src/endpoints/get_quest_participants.rs | 6 +- src/endpoints/get_quests.rs | 2 +- src/endpoints/get_quiz.rs | 2 +- src/endpoints/get_tasks.rs | 2 +- src/endpoints/get_trending_quests.rs | 2 +- src/endpoints/has_completed_quest.rs | 108 +++++++++--------- src/endpoints/leaderboard/get_ranking.rs | 3 +- src/endpoints/leaderboard/get_static_info.rs | 3 +- src/endpoints/quest_boost/get_boost.rs | 2 +- src/endpoints/quest_boost/get_boosts.rs | 2 +- src/endpoints/quest_boost/get_claim_params.rs | 3 +- .../quest_boost/get_completed_boosts.rs | 3 +- .../quest_boost/get_pending_claims.rs | 3 +- src/endpoints/quest_boost/get_quests.rs | 2 +- src/endpoints/quests/avnu/claimable.rs | 6 +- .../quests/avnu/discord_fw_callback.rs | 6 +- src/endpoints/quests/avnu/verify_swap.rs | 6 +- src/endpoints/quests/bountive/claimable.rs | 12 +- .../quests/bountive/verify_deposit.rs | 7 +- .../quests/bountive/verify_twitter_fw.rs | 6 +- .../quests/bountive/verify_twitter_rt.rs | 6 +- .../quests/braavos/avnu/claimable.rs | 6 +- .../quests/braavos/avnu/verify_has_domain.rs | 6 +- .../quests/braavos/avnu/verify_swap.rs | 6 +- .../braavos/avnu/verify_twitter_fw_avnu.rs | 6 +- .../braavos/avnu/verify_twitter_fw_braavos.rs | 6 +- .../quests/braavos/avnu/verify_twitter_rt.rs | 6 +- .../quests/braavos/carbonable/claimable.rs | 6 +- .../braavos/carbonable/verify_deposit.rs | 8 +- .../braavos/carbonable/verify_has_domain.rs | 6 +- .../carbonable/verify_twitter_fw_braavos.rs | 6 +- .../verify_twitter_fw_carbonable.rs | 6 +- .../braavos/carbonable/verify_twitter_rt.rs | 6 +- .../quests/braavos/myswap/claimable.rs | 6 +- .../braavos/myswap/verify_added_liquidity.rs | 6 +- .../braavos/myswap/verify_has_domain.rs | 6 +- .../myswap/verify_twitter_fw_braavos.rs | 6 +- .../myswap/verify_twitter_fw_myswap.rs | 6 +- .../quests/braavos/pyramid/claimable.rs | 6 +- .../braavos/pyramid/verify_buy_or_list.rs | 6 +- .../braavos/pyramid/verify_has_domain.rs | 6 +- .../pyramid/verify_twitter_fw_braavos.rs | 6 +- .../pyramid/verify_twitter_fw_pyramid.rs | 6 +- .../braavos/pyramid/verify_twitter_rt.rs | 6 +- .../quests/braavos/realms/claimable.rs | 6 +- .../braavos/realms/verify_has_domain.rs | 6 +- .../braavos/realms/verify_has_played.rs | 6 +- .../realms/verify_twitter_fw_braavos.rs | 6 +- .../realms/verify_twitter_fw_realms.rs | 6 +- .../braavos/realms/verify_twitter_rt.rs | 6 +- .../quests/braavos/starknetid/claimable.rs | 6 +- .../braavos/starknetid/verify_has_domain.rs | 6 +- .../braavos/starknetid/verify_has_mission.rs | 6 +- .../starknetid/verify_twitter_fw_braavos.rs | 6 +- .../starknetid/verify_twitter_fw_sid.rs | 6 +- .../starknetid/verify_twitter_fw_sq.rs | 6 +- .../quests/braavos/wallet/claimable.rs | 6 +- .../braavos/wallet/verify_has_domain.rs | 6 +- .../wallet/verify_twitter_fw_braavos.rs | 6 +- .../braavos/wallet/verify_twitter_rt.rs | 6 +- .../quests/braavos/zklend/claimable.rs | 6 +- .../braavos/zklend/verify_added_liquidity.rs | 6 +- .../braavos/zklend/verify_has_domain.rs | 6 +- .../zklend/verify_twitter_fw_braavos.rs | 6 +- .../zklend/verify_twitter_fw_zklend.rs | 6 +- .../braavos/zklend/verify_twitter_rt.rs | 6 +- src/endpoints/quests/carmine/claimable.rs | 6 +- src/endpoints/quests/claimable.rs | 22 ++-- src/endpoints/quests/contract_uri.rs | 2 +- src/endpoints/quests/discord_fw_callback.rs | 25 ++-- src/endpoints/quests/ekubo/claimable.rs | 6 +- .../quests/ekubo/discord_fw_callback.rs | 6 +- .../quests/ekubo/verify_added_liquidity.rs | 6 +- .../quests/element/briq/claimable.rs | 6 +- .../quests/element/briq/verify_own_briq.rs | 6 +- .../quests/element/briq/verify_twitter_fw.rs | 6 +- .../quests/element/element/claimable.rs | 6 +- .../element/element/verify_is_eligible.rs | 6 +- .../element/element/verify_twitter_fw.rs | 6 +- .../quests/element/layerswap/claimable.rs | 6 +- .../element/layerswap/verify_has_bridged.rs | 6 +- .../element/layerswap/verify_twitter_fw.rs | 6 +- .../element/layerswap/verify_twitter_rt.rs | 6 +- .../quests/element/starknetid/claimable.rs | 6 +- .../starknetid/verify_has_root_domain.rs | 6 +- .../engagement/discord_fw_callback.rs | 6 +- .../focustree/engagement/verify_twitter_rt.rs | 6 +- .../focustree/introduction/claimable.rs | 6 +- .../introduction/verify_twitter_fw.rs | 6 +- .../introduction/verify_twitter_rt.rs | 6 +- src/endpoints/quests/haiko/claimable.rs | 12 +- src/endpoints/quests/haiko/verify_deposit.rs | 14 ++- .../quests/haiko/verify_twitter_fw.rs | 6 +- .../quests/haiko/verify_twitter_rw.rs | 6 +- src/endpoints/quests/hashstack/claimable.rs | 12 +- .../quests/hashstack/discord_fw_callback.rs | 7 +- .../quests/hashstack/verify_deposit.rs | 7 +- .../quests/hashstack/verify_has_domain.rs | 6 +- .../hashstack/verify_twitter_fw_hashstack.rs | 6 +- .../quests/hashstack/verify_twitter_rw.rs | 6 +- src/endpoints/quests/influence/claimable.rs | 12 +- .../quests/influence/discord_fw_callback.rs | 7 +- .../quests/influence/verify_twitter_fw.rs | 6 +- .../quests/influence/verify_twitter_rw.rs | 6 +- .../quests/influence/verify_twitter_rw_2.rs | 6 +- src/endpoints/quests/jediswap/claimable.rs | 6 +- .../quests/jediswap/verify_added_liquidity.rs | 6 +- .../quests/jediswap/verify_twitter_fw.rs | 6 +- .../quests/jediswap/verify_twitter_rt.rs | 6 +- src/endpoints/quests/morphine/claimable.rs | 6 +- .../quests/morphine/verify_added_liquidity.rs | 6 +- src/endpoints/quests/myswap/claimable.rs | 6 +- .../quests/myswap/discord_fw_callback.rs | 6 +- .../quests/myswap/verify_added_liquidity.rs | 6 +- src/endpoints/quests/nimbora/check_balance.rs | 7 +- src/endpoints/quests/nimbora/claimable.rs | 8 +- .../quests/nimbora/discord_fw_callback.rs | 8 +- .../quests/nimbora/verify_twitter_rt.rs | 6 +- .../nostra/liquidity_quest/claimable.rs | 12 +- .../liquidity_quest/discord_fw_callback.rs | 7 +- .../liquidity_quest/verify_added_liquidity.rs | 7 +- .../quests/nostra/staking_quest/claimable.rs | 12 +- .../nostra/staking_quest/verify_stake.rs | 6 +- .../nostra/staking_quest/verify_twitter_tw.rs | 6 +- src/endpoints/quests/orbiter/claimable.rs | 6 +- .../quests/orbiter/verify_has_bridged.rs | 6 +- .../quests/orbiter/verify_has_root_domain.rs | 6 +- .../quests/orbiter/verify_twitter_fw.rs | 6 +- .../quests/orbiter/verify_twitter_fw_sq.rs | 6 +- .../quests/orbiter/verify_twitter_rt.rs | 6 +- .../quests/rango/quest1/check_trade.rs | 16 +-- .../quests/rango/quest1/claimable.rs | 12 +- .../rango/quest1/discord_fw_callback.rs | 6 +- .../quests/rango/quest1/verify_twitter_fw.rs | 6 +- .../quests/rango/quest2/check_trade.rs | 6 +- .../quests/rango/quest2/claimable.rs | 12 +- .../rango/quest2/discord_fw_callback.rs | 6 +- .../quests/rango/quest2/verify_twitter_fw.rs | 6 +- .../quests/rango/quest2/verify_twitter_rw.rs | 6 +- src/endpoints/quests/rhino/check_bridge.rs | 6 +- src/endpoints/quests/rhino/claimable.rs | 10 +- .../quests/rhino/verify_twitter_fw.rs | 6 +- .../quests/rhino/verify_twitter_rw.rs | 6 +- .../quests/sithswap/quest1/claimable.rs | 6 +- .../sithswap/quest1/verify_added_liquidity.rs | 6 +- .../sithswap/quest1/verify_twitter_fw.rs | 6 +- .../quests/sithswap/quest2/claimable.rs | 14 +-- .../quests/sithswap/quest2/verify_deposit.rs | 13 +-- .../sithswap/quest2/verify_has_domain.rs | 6 +- .../sithswap/quest2/verify_twitter_fw.rs | 6 +- .../sithswap/quest2/verify_twitter_rw.rs | 6 +- .../quests/starknet/aa_mastery/claimable.rs | 6 +- .../quests/starknet/gigabrain/claimable.rs | 6 +- src/endpoints/quests/starknetid/claimable.rs | 6 +- .../quests/starknetid/verify_has_domain.rs | 6 +- .../starknetid/verify_has_root_domain.rs | 6 +- .../quests/starknetid/verify_socials.rs | 6 +- .../quests/starknetid/verify_twitter_fw.rs | 6 +- .../quests/strk_farm/check_balance.rs | 6 +- src/endpoints/quests/tribe/claimable.rs | 6 +- .../quests/tribe/verify_has_domain.rs | 6 +- .../quests/tribe/verify_has_root_domain.rs | 6 +- .../quests/tribe/verify_three_years_expiry.rs | 6 +- src/endpoints/quests/uri.rs | 38 +++--- src/endpoints/quests/verify_balance.rs | 6 +- src/endpoints/quests/verify_domain.rs | 6 +- src/endpoints/quests/verify_quiz.rs | 2 +- src/endpoints/quests/verify_twitter_fw.rs | 28 ++--- src/endpoints/quests/verify_twitter_rw.rs | 8 +- src/endpoints/quests/zklend/claimable.rs | 6 +- src/endpoints/quests/zklend/verify_borrow.rs | 6 +- .../quests/zklend/verify_twitter_fw.rs | 6 +- src/endpoints/unique_page_visit.rs | 27 +++-- 227 files changed, 399 insertions(+), 1042 deletions(-) diff --git a/src/endpoints/achievements/batched/verify_tvl_batched.rs b/src/endpoints/achievements/batched/verify_tvl_batched.rs index eff70ac5..0b036d42 100644 --- a/src/endpoints/achievements/batched/verify_tvl_batched.rs +++ b/src/endpoints/achievements/batched/verify_tvl_batched.rs @@ -17,8 +17,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/batched/verify_tvl_batched", - crate::endpoints::achievements::batched::verify_tvl_batched + "/achievements/batched/verify_tvl_batched" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/claim/quests_achievement.rs b/src/endpoints/achievements/claim/quests_achievement.rs index ebb0ec65..d9e088b0 100644 --- a/src/endpoints/achievements/claim/quests_achievement.rs +++ b/src/endpoints/achievements/claim/quests_achievement.rs @@ -29,8 +29,7 @@ fn get_number_of_quests(id: u32) -> u32 { #[route( get, - "/achievements/claim/quest_achievement", - crate::endpoints::achievements::claim::quests_achievement + "/achievements/claim/quest_achievement" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/fetch.rs b/src/endpoints/achievements/fetch.rs index 48afba5c..273da747 100644 --- a/src/endpoints/achievements/fetch.rs +++ b/src/endpoints/achievements/fetch.rs @@ -17,8 +17,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/fetch", - crate::endpoints::achievements::fetch + "/achievements/fetch" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/fetch_buildings.rs b/src/endpoints/achievements/fetch_buildings.rs index 5e4ed8e1..3ac35b33 100644 --- a/src/endpoints/achievements/fetch_buildings.rs +++ b/src/endpoints/achievements/fetch_buildings.rs @@ -16,8 +16,7 @@ use mongodb::bson::{doc, from_document}; #[route( get, - "/achievements/fetch_buildings", - crate::endpoints::achievements::fetch_buildings + "/achievements/fetch_buildings" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_achieved_quests.rs b/src/endpoints/achievements/verify_achieved_quests.rs index 56746770..d3bd4847 100644 --- a/src/endpoints/achievements/verify_achieved_quests.rs +++ b/src/endpoints/achievements/verify_achieved_quests.rs @@ -16,8 +16,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/verify_achieved_quests", - crate::endpoints::achievements::verify_achieved_quests + "/achievements/verify_achieved_quests" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_avnu.rs b/src/endpoints/achievements/verify_avnu.rs index 789fb2f0..1663baad 100644 --- a/src/endpoints/achievements/verify_avnu.rs +++ b/src/endpoints/achievements/verify_avnu.rs @@ -16,8 +16,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/verify_avnu", - crate::endpoints::achievements::verify_avnu + "/achievements/verify_avnu" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_briq.rs b/src/endpoints/achievements/verify_briq.rs index 8a71f192..14d14074 100644 --- a/src/endpoints/achievements/verify_briq.rs +++ b/src/endpoints/achievements/verify_briq.rs @@ -18,8 +18,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/verify_briq", - crate::endpoints::achievements::verify_briq + "/achievements/verify_briq" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_default.rs b/src/endpoints/achievements/verify_default.rs index eff39efc..80ee1129 100644 --- a/src/endpoints/achievements/verify_default.rs +++ b/src/endpoints/achievements/verify_default.rs @@ -44,8 +44,7 @@ fn get_args(config: Config, achievement_id: u32) -> Result<(FieldElement, u32, N #[route( get, - "/achievements/verify_default", - crate::endpoints::achievements::verify_default + "/achievements/verify_default" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_has_domain.rs b/src/endpoints/achievements/verify_has_domain.rs index 94ceecc2..773a95e2 100644 --- a/src/endpoints/achievements/verify_has_domain.rs +++ b/src/endpoints/achievements/verify_has_domain.rs @@ -22,9 +22,7 @@ use std::{ #[route( get, - "/achievements/verify_has_domain", - crate::endpoints::achievements::verify_has_domain -)] + "/achievements/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/achievements/verify_quests.rs b/src/endpoints/achievements/verify_quests.rs index 248f1d48..fb53cf6c 100644 --- a/src/endpoints/achievements/verify_quests.rs +++ b/src/endpoints/achievements/verify_quests.rs @@ -30,8 +30,7 @@ fn get_number_of_quests(id: u32) -> u32 { #[route( get, - "/achievements/verify_quests", - crate::endpoints::achievements::verify_quests + "/achievements/verify_quests" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_seniority.rs b/src/endpoints/achievements/verify_seniority.rs index caf0565a..628f7966 100644 --- a/src/endpoints/achievements/verify_seniority.rs +++ b/src/endpoints/achievements/verify_seniority.rs @@ -18,8 +18,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/verify_seniority", - crate::endpoints::achievements::verify_seniority + "/achievements/verify_seniority" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/achievements/verify_tvl.rs b/src/endpoints/achievements/verify_tvl.rs index cdd47ed4..f8d25dc7 100644 --- a/src/endpoints/achievements/verify_tvl.rs +++ b/src/endpoints/achievements/verify_tvl.rs @@ -16,8 +16,7 @@ use starknet::core::types::FieldElement; #[route( get, - "/achievements/verify_tvl", - crate::endpoints::achievements::verify_tvl + "/achievements/verify_tvl" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/balance/create_balance.rs b/src/endpoints/admin/balance/create_balance.rs index 15bf610a..15d6cb83 100644 --- a/src/endpoints/admin/balance/create_balance.rs +++ b/src/endpoints/admin/balance/create_balance.rs @@ -28,8 +28,7 @@ pub_struct!(Deserialize; CreateBalance { #[route( post, - "/admin/tasks/balance/create", - crate::endpoints::admin::balance::create_balance + "/admin/tasks/balance/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/balance/update_balance.rs b/src/endpoints/admin/balance/update_balance.rs index b109fe98..e2e913b8 100644 --- a/src/endpoints/admin/balance/update_balance.rs +++ b/src/endpoints/admin/balance/update_balance.rs @@ -32,8 +32,7 @@ fn field_element_to_bson(fe: &FieldElement) -> mongodb::bson::Bson { #[route( post, - "/admin/tasks/balance/update", - crate::endpoints::admin::balance::update_balance + "/admin/tasks/balance/update" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/custom/create_custom.rs b/src/endpoints/admin/custom/create_custom.rs index 01e37da1..2709f20e 100644 --- a/src/endpoints/admin/custom/create_custom.rs +++ b/src/endpoints/admin/custom/create_custom.rs @@ -26,8 +26,7 @@ pub_struct!(Deserialize; CreateCustom { #[route( post, - "/admin/tasks/custom/create", - crate::endpoints::admin::custom::create_custom + "/admin/tasks/custom/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/custom/update_custom.rs b/src/endpoints/admin/custom/update_custom.rs index 294e269c..4897429b 100644 --- a/src/endpoints/admin/custom/update_custom.rs +++ b/src/endpoints/admin/custom/update_custom.rs @@ -26,7 +26,7 @@ pub_struct!(Deserialize; CreateCustom { href: Option, }); -#[route(post, "/admin/tasks/custom/update", crate::endpoints::admin::custom::update_custom)] +#[route(post, "/admin/tasks/custom/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/delete_task.rs b/src/endpoints/admin/delete_task.rs index b2069c3f..2b6d046f 100644 --- a/src/endpoints/admin/delete_task.rs +++ b/src/endpoints/admin/delete_task.rs @@ -19,7 +19,7 @@ pub_struct!(Deserialize; DeleteTask { id: i32, }); -#[route(post, "/admin/tasks/remove_task", crate::endpoints::admin::delete_task)] +#[route(post, "/admin/tasks/remove_task")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/discord/create_discord.rs b/src/endpoints/admin/discord/create_discord.rs index d57e85d1..072de4cc 100644 --- a/src/endpoints/admin/discord/create_discord.rs +++ b/src/endpoints/admin/discord/create_discord.rs @@ -25,8 +25,7 @@ pub_struct!(Deserialize; CreateCustom { #[route( post, - "/admin/tasks/discord/create", - crate::endpoints::admin::discord::create_discord + "/admin/tasks/discord/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/discord/update_discord.rs b/src/endpoints/admin/discord/update_discord.rs index 1b372ee4..5d2c94ee 100644 --- a/src/endpoints/admin/discord/update_discord.rs +++ b/src/endpoints/admin/discord/update_discord.rs @@ -23,7 +23,7 @@ pub_struct!(Deserialize; CreateCustom { guild_id: Option, }); -#[route(post, "/admin/tasks/discord/update", crate::endpoints::admin::discord::update_discord)] +#[route(post, "/admin/tasks/discord/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/domain/create_domain.rs b/src/endpoints/admin/domain/create_domain.rs index 83d32be6..9cf5430f 100644 --- a/src/endpoints/admin/domain/create_domain.rs +++ b/src/endpoints/admin/domain/create_domain.rs @@ -23,8 +23,7 @@ pub_struct!(Deserialize; CreateTwitterFw { #[route( post, - "/admin/tasks/domain/create", - crate::endpoints::admin::domain::create_domain + "/admin/tasks/domain/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/domain/update_domain.rs b/src/endpoints/admin/domain/update_domain.rs index 80cbc0a9..20bc0dc1 100644 --- a/src/endpoints/admin/domain/update_domain.rs +++ b/src/endpoints/admin/domain/update_domain.rs @@ -21,7 +21,7 @@ pub_struct!(Deserialize; CreateTwitterFw { id: i32, }); -#[route(post, "/admin/tasks/domain/update", crate::endpoints::admin::domain::update_domain)] +#[route(post, "/admin/tasks/domain/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/login.rs b/src/endpoints/admin/login.rs index 8d581eab..7461feb0 100644 --- a/src/endpoints/admin/login.rs +++ b/src/endpoints/admin/login.rs @@ -20,7 +20,7 @@ pub struct GetQuestsQuery { code: String, } -#[route(get, "/admin/login", crate::endpoints::admin::login)] +#[route(get, "/admin/login")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/admin/nft_uri/create_uri.rs b/src/endpoints/admin/nft_uri/create_uri.rs index b94b3062..da369f67 100644 --- a/src/endpoints/admin/nft_uri/create_uri.rs +++ b/src/endpoints/admin/nft_uri/create_uri.rs @@ -23,7 +23,7 @@ pub_struct!(Deserialize; CreateCustom { image: String, }); -#[route(post, "/admin/nft_uri/create", crate::endpoints::admin::nft_uri::create_uri)] +#[route(post, "/admin/nft_uri/create")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/nft_uri/get_nft_uri.rs b/src/endpoints/admin/nft_uri/get_nft_uri.rs index 04a0f88a..00e68928 100644 --- a/src/endpoints/admin/nft_uri/get_nft_uri.rs +++ b/src/endpoints/admin/nft_uri/get_nft_uri.rs @@ -22,8 +22,7 @@ pub struct GetQuestsQuery { #[route( get, - "/admin/nft_uri/get_nft_uri", - crate::endpoints::admin::nft_uri::get_nft_uri + "/admin/nft_uri/get_nft_uri" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/nft_uri/update_uri.rs b/src/endpoints/admin/nft_uri/update_uri.rs index 69702fbb..b9a348c9 100644 --- a/src/endpoints/admin/nft_uri/update_uri.rs +++ b/src/endpoints/admin/nft_uri/update_uri.rs @@ -21,7 +21,7 @@ pub_struct!(Deserialize; CreateCustom { image: Option, }); -#[route(post, "/admin/nft_uri/update", crate::endpoints::admin::nft_uri::update_uri)] +#[route(post, "/admin/nft_uri/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/quest/create_quest.rs b/src/endpoints/admin/quest/create_quest.rs index 80e78b96..e5d7f887 100644 --- a/src/endpoints/admin/quest/create_quest.rs +++ b/src/endpoints/admin/quest/create_quest.rs @@ -31,8 +31,7 @@ pub_struct!(Deserialize; CreateQuestQuery { #[route( post, -"/admin/quest/create", -crate::endpoints::admin::quest::create_quest +"/admin/quest/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quest/get_quest.rs b/src/endpoints/admin/quest/get_quest.rs index d04c894a..f54ffc2f 100644 --- a/src/endpoints/admin/quest/get_quest.rs +++ b/src/endpoints/admin/quest/get_quest.rs @@ -23,8 +23,7 @@ pub struct GetQuestsQuery { #[route( get, - "/admin/quest/get_quest", - crate::endpoints::admin::quest::get_quest + "/admin/quest/get_quest" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quest/get_quests.rs b/src/endpoints/admin/quest/get_quests.rs index aed3e897..1e1d961e 100644 --- a/src/endpoints/admin/quest/get_quests.rs +++ b/src/endpoints/admin/quest/get_quests.rs @@ -16,8 +16,7 @@ use std::sync::Arc; #[route( get, - "/admin/quest/get_quests", - crate::endpoints::admin::quest::get_quests + "/admin/quest/get_quests" )] pub async fn handler(State(state): State>, headers: HeaderMap) -> impl IntoResponse { let user = check_authorization!(headers, &state.conf.auth.secret_key.as_ref()); diff --git a/src/endpoints/admin/quest/get_tasks.rs b/src/endpoints/admin/quest/get_tasks.rs index 9bc261a0..36aaf716 100644 --- a/src/endpoints/admin/quest/get_tasks.rs +++ b/src/endpoints/admin/quest/get_tasks.rs @@ -31,7 +31,7 @@ pub struct GetTasksQuery { quest_id: u32, } -#[route(get, "/admin/quest/get_tasks", crate::endpoints::admin::quest::get_tasks)] +#[route(get, "/admin/quest/get_tasks")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/admin/quest/update_quest.rs b/src/endpoints/admin/quest/update_quest.rs index 174afdae..dbc3aca4 100644 --- a/src/endpoints/admin/quest/update_quest.rs +++ b/src/endpoints/admin/quest/update_quest.rs @@ -31,7 +31,7 @@ pub_struct!(Deserialize; UpdateQuestQuery { issuer: Option, }); -#[route(post, "/admin/quest/update", crate::endpoints::admin::quest::update_quest)] +#[route(post, "/admin/quest/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/quest_boost/create_boost.rs b/src/endpoints/admin/quest_boost/create_boost.rs index 1a307bcb..c8cea914 100644 --- a/src/endpoints/admin/quest_boost/create_boost.rs +++ b/src/endpoints/admin/quest_boost/create_boost.rs @@ -31,8 +31,7 @@ pub struct CreateBoostQuery { #[route( post, - "/admin/quest_boost/create_boost", - crate::endpoints::admin::quest_boost::create_boost + "/admin/quest_boost/create_boost" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quest_boost/update_boost.rs b/src/endpoints/admin/quest_boost/update_boost.rs index 9a39c4f4..92dc074e 100644 --- a/src/endpoints/admin/quest_boost/update_boost.rs +++ b/src/endpoints/admin/quest_boost/update_boost.rs @@ -29,8 +29,7 @@ pub_struct!(Deserialize; UpdateBoostQuery { #[route( post, -"/admin/quest_boost/update_boost", -crate::endpoints::admin::quest_boost::update_boost +"/admin/quest_boost/update_boost" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quiz/create_question.rs b/src/endpoints/admin/quiz/create_question.rs index 60271268..a1c50410 100644 --- a/src/endpoints/admin/quiz/create_question.rs +++ b/src/endpoints/admin/quiz/create_question.rs @@ -24,8 +24,7 @@ pub_struct!(Deserialize; CreateQuizQuestion { #[route( post, - "/admin/tasks/quiz/question/create", - crate::endpoints::admin::quiz::create_question + "/admin/tasks/quiz/question/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quiz/create_quiz.rs b/src/endpoints/admin/quiz/create_quiz.rs index d588ac0e..e1e133d7 100644 --- a/src/endpoints/admin/quiz/create_quiz.rs +++ b/src/endpoints/admin/quiz/create_quiz.rs @@ -26,8 +26,7 @@ pub_struct!(Deserialize; CreateQuiz { #[route( post, - "/admin/tasks/quiz/create", - crate::endpoints::admin::quiz::create_quiz + "/admin/tasks/quiz/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quiz/get_quiz.rs b/src/endpoints/admin/quiz/get_quiz.rs index 11bf81c8..e505fe54 100644 --- a/src/endpoints/admin/quiz/get_quiz.rs +++ b/src/endpoints/admin/quiz/get_quiz.rs @@ -24,8 +24,7 @@ pub struct GetQuestsQuery { #[route( get, - "/admin/quiz/get_quiz", - crate::endpoints::admin::quiz::get_quiz, + "/admin/quiz/get_quiz" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quiz/update_question.rs b/src/endpoints/admin/quiz/update_question.rs index 5c3ddef8..b05ad61c 100644 --- a/src/endpoints/admin/quiz/update_question.rs +++ b/src/endpoints/admin/quiz/update_question.rs @@ -27,8 +27,7 @@ pub_struct!(Deserialize; UpdateQuiz { #[route( post, - "/admin/tasks/quiz/question/update", - crate::endpoints::admin::quiz::update_question + "/admin/tasks/quiz/question/update" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/quiz/update_quiz.rs b/src/endpoints/admin/quiz/update_quiz.rs index fa3125fe..0b4c7478 100644 --- a/src/endpoints/admin/quiz/update_quiz.rs +++ b/src/endpoints/admin/quiz/update_quiz.rs @@ -27,7 +27,7 @@ pub_struct!(Deserialize; UpdateQuiz { intro: Option, }); -#[route(post, "/admin/tasks/quiz/update", crate::endpoints::admin::quiz::update_quiz)] +#[route(post, "/admin/tasks/quiz/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/twitter/create_twitter_fw.rs b/src/endpoints/admin/twitter/create_twitter_fw.rs index e30ee439..955bfbf6 100644 --- a/src/endpoints/admin/twitter/create_twitter_fw.rs +++ b/src/endpoints/admin/twitter/create_twitter_fw.rs @@ -24,8 +24,7 @@ pub_struct!(Deserialize; CreateTwitterFw { #[route( post, - "/admin/tasks/twitter_fw/create", - crate::endpoints::admin::twitter::create_twitter_fw + "/admin/tasks/twitter_fw/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/twitter/create_twitter_rw.rs b/src/endpoints/admin/twitter/create_twitter_rw.rs index 420db5e6..72dbe999 100644 --- a/src/endpoints/admin/twitter/create_twitter_rw.rs +++ b/src/endpoints/admin/twitter/create_twitter_rw.rs @@ -24,8 +24,7 @@ pub_struct!(Deserialize; CreateTwitterRw { #[route( post, - "/admin/tasks/twitter_rw/create", - crate::endpoints::admin::twitter::create_twitter_rw + "/admin/tasks/twitter_rw/create" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/twitter/update_twitter_fw.rs b/src/endpoints/admin/twitter/update_twitter_fw.rs index d68dc893..670cb8ae 100644 --- a/src/endpoints/admin/twitter/update_twitter_fw.rs +++ b/src/endpoints/admin/twitter/update_twitter_fw.rs @@ -24,8 +24,7 @@ pub_struct!(Deserialize; UpdateTwitterFw { #[route( post, -"/admin/tasks/twitter_fw/update", -crate::endpoints::admin::twitter::update_twitter_fw +"/admin/tasks/twitter_fw/update" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/admin/twitter/update_twitter_rw.rs b/src/endpoints/admin/twitter/update_twitter_rw.rs index 61db091e..a7007146 100644 --- a/src/endpoints/admin/twitter/update_twitter_rw.rs +++ b/src/endpoints/admin/twitter/update_twitter_rw.rs @@ -23,7 +23,7 @@ pub_struct!(Deserialize; UpdateTwitterRw { id: i32, }); -#[route(post, "/admin/tasks/twitter_rw/update", crate::endpoints::admin::twitter::update_twitter_rw)] +#[route(post, "/admin/tasks/twitter_rw/update")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/admin/user/create_user.rs b/src/endpoints/admin/user/create_user.rs index 84153bd8..384320d5 100644 --- a/src/endpoints/admin/user/create_user.rs +++ b/src/endpoints/admin/user/create_user.rs @@ -19,7 +19,7 @@ pub_struct!(Deserialize; CreateCustom { password: String, }); -#[route(post, "/admin/user/create", crate::endpoints::admin::user::create_user)] +#[route(post, "/admin/user/create")] pub async fn handler( State(state): State>, headers: HeaderMap, diff --git a/src/endpoints/analytics/get_quest_activity.rs b/src/endpoints/analytics/get_quest_activity.rs index 2c9e571a..00bc1124 100644 --- a/src/endpoints/analytics/get_quest_activity.rs +++ b/src/endpoints/analytics/get_quest_activity.rs @@ -18,8 +18,7 @@ pub struct GetQuestsQuery { #[route( get, -"/analytics/get_quest_activity", -crate::endpoints::analytics::get_quest_activity +"/analytics/get_quest_activity" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/analytics/get_quest_participation.rs b/src/endpoints/analytics/get_quest_participation.rs index c9a6afec..ed3d9fd5 100644 --- a/src/endpoints/analytics/get_quest_participation.rs +++ b/src/endpoints/analytics/get_quest_participation.rs @@ -18,8 +18,7 @@ pub struct GetQuestsQuery { #[route( get, - "/analytics/get_quest_participation", - crate::endpoints::analytics::get_quest_participation + "/analytics/get_quest_participation" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/analytics/get_unique_visitors.rs b/src/endpoints/analytics/get_unique_visitors.rs index 9c508c3d..1730d421 100644 --- a/src/endpoints/analytics/get_unique_visitors.rs +++ b/src/endpoints/analytics/get_unique_visitors.rs @@ -18,8 +18,7 @@ pub struct GetQuestsQuery { #[route( get, -"/analytics/get_unique_visitors", -crate::endpoints::analytics::get_unique_visitors +"/analytics/get_unique_visitors" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/discover/defi/get_alt_protocol_stats.rs b/src/endpoints/discover/defi/get_alt_protocol_stats.rs index ba44216a..23bcb0ca 100644 --- a/src/endpoints/discover/defi/get_alt_protocol_stats.rs +++ b/src/endpoints/discover/defi/get_alt_protocol_stats.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; use std::sync::Arc; use serde_json::Value; -#[route(get, "/discover/defi/get_alt_protocol_stats", crate::endpoints::discover::defi::get_alt_protocol_stats)] +#[route(get, "/discover/defi/get_alt_protocol_stats")] pub async fn handler(State(state): State>) -> impl IntoResponse { let endpoint = &state.conf.discover.alt_protocols_api_endpoint; let client = reqwest::Client::new(); diff --git a/src/endpoints/discover/defi/get_derivatives_stats.rs b/src/endpoints/discover/defi/get_derivatives_stats.rs index 2bad3c23..0ed6e369 100644 --- a/src/endpoints/discover/defi/get_derivatives_stats.rs +++ b/src/endpoints/discover/defi/get_derivatives_stats.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; use std::sync::Arc; use serde_json::Value; -#[route(get, "/discover/defi/get_derivatives_stats", crate::endpoints::discover::defi::get_derivatives_stats)] +#[route(get, "/discover/defi/get_derivatives_stats")] pub async fn handler(State(state): State>) -> impl IntoResponse { let endpoint = &state.conf.discover.derivates_api_endpoint; let client = reqwest::Client::new(); diff --git a/src/endpoints/discover/defi/get_lend_stats.rs b/src/endpoints/discover/defi/get_lend_stats.rs index cf9f637f..eb23ae3d 100644 --- a/src/endpoints/discover/defi/get_lend_stats.rs +++ b/src/endpoints/discover/defi/get_lend_stats.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; use std::sync::Arc; use serde_json::Value; -#[route(get, "/discover/defi/get_lend_stats", crate::endpoints::discover::defi::get_lend_stats)] +#[route(get, "/discover/defi/get_lend_stats")] pub async fn handler(State(state): State>) -> impl IntoResponse { let endpoint = &state.conf.discover.lending_api_endpoint; let client = reqwest::Client::new(); diff --git a/src/endpoints/discover/defi/get_pair_stats.rs b/src/endpoints/discover/defi/get_pair_stats.rs index c3f23eda..7e79dc49 100644 --- a/src/endpoints/discover/defi/get_pair_stats.rs +++ b/src/endpoints/discover/defi/get_pair_stats.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; use std::sync::Arc; use serde_json::Value; -#[route(get, "/discover/defi/get_pair_stats", crate::endpoints::discover::defi::get_pair_stats)] +#[route(get, "/discover/defi/get_pair_stats")] pub async fn handler(State(state): State>) -> impl IntoResponse { let endpoint = &state.conf.discover.pairs_api_endpoint; let client = reqwest::Client::new(); diff --git a/src/endpoints/get_boosted_quests.rs b/src/endpoints/get_boosted_quests.rs index 6f64458a..815b4bd8 100644 --- a/src/endpoints/get_boosted_quests.rs +++ b/src/endpoints/get_boosted_quests.rs @@ -7,7 +7,7 @@ use mongodb::bson::{doc, Document}; use reqwest::StatusCode; use std::sync::Arc; -#[route(get, "/get_boosted_quests", crate::endpoints::get_boosted_quests)] +#[route(get, "/get_boosted_quests")] pub async fn handler(State(state): State>) -> impl IntoResponse { let pipeline = vec![ doc! { diff --git a/src/endpoints/get_completed_quests.rs b/src/endpoints/get_completed_quests.rs index cca1debb..f4756f03 100644 --- a/src/endpoints/get_completed_quests.rs +++ b/src/endpoints/get_completed_quests.rs @@ -19,7 +19,7 @@ pub struct GetCompletedQuestsQuery { addr: FieldElement, } -#[route(get, "/get_completed_quests", crate::endpoints::get_completed_quests)] +#[route(get, "/get_completed_quests")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_deployed_time.rs b/src/endpoints/get_deployed_time.rs index 3f7f007f..cce666ba 100644 --- a/src/endpoints/get_deployed_time.rs +++ b/src/endpoints/get_deployed_time.rs @@ -19,7 +19,7 @@ pub struct GetDeployedTimeQuery { addr: FieldElement, } -#[route(get, "/get_deployed_time", crate::endpoints::get_deployed_time)] +#[route(get, "/get_deployed_time")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_quest.rs b/src/endpoints/get_quest.rs index fbd1590e..21199cdb 100644 --- a/src/endpoints/get_quest.rs +++ b/src/endpoints/get_quest.rs @@ -19,7 +19,7 @@ pub struct GetQuestsQuery { id: u32, } -#[route(get, "/get_quest", crate::endpoints::get_quest)] +#[route(get, "/get_quest")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_quest_category.rs b/src/endpoints/get_quest_category.rs index eb9730f4..59276372 100644 --- a/src/endpoints/get_quest_category.rs +++ b/src/endpoints/get_quest_category.rs @@ -17,7 +17,7 @@ pub struct GetQuestsQuery { name: String, } -#[route(get, "/get_quest_category", crate::endpoints::get_quest_category)] +#[route(get, "/get_quest_category")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_quest_participants.rs b/src/endpoints/get_quest_participants.rs index a54ae7e1..634d3402 100644 --- a/src/endpoints/get_quest_participants.rs +++ b/src/endpoints/get_quest_participants.rs @@ -18,11 +18,7 @@ pub struct GetQuestParticipantsQuery { quest_id: u32, } -#[route( - get, - "/get_quest_participants", - crate::endpoints::get_quest_participants -)] +#[route(get, "/get_quest_participants")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_quests.rs b/src/endpoints/get_quests.rs index c424b43c..1a419ad4 100644 --- a/src/endpoints/get_quests.rs +++ b/src/endpoints/get_quests.rs @@ -21,7 +21,7 @@ pub struct NFTItem { pub(crate) level: u32, } -#[route(get, "/get_quests", crate::endpoints::get_quests)] +#[route(get, "/get_quests")] pub async fn handler(State(state): State>) -> impl IntoResponse { let current_time = chrono::Utc::now().timestamp_millis(); diff --git a/src/endpoints/get_quiz.rs b/src/endpoints/get_quiz.rs index d2083450..f8e0a6e9 100644 --- a/src/endpoints/get_quiz.rs +++ b/src/endpoints/get_quiz.rs @@ -21,7 +21,7 @@ pub struct GetQuizQuery { } -#[route(get, "/get_quiz", crate::endpoints::get_quiz)] +#[route(get, "/get_quiz")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_tasks.rs b/src/endpoints/get_tasks.rs index e75c4325..c96bbc3b 100644 --- a/src/endpoints/get_tasks.rs +++ b/src/endpoints/get_tasks.rs @@ -32,7 +32,7 @@ pub struct GetTasksQuery { addr: FieldElement, } -#[route(get, "/get_tasks", crate::endpoints::get_tasks)] +#[route(get, "/get_tasks")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/get_trending_quests.rs b/src/endpoints/get_trending_quests.rs index 7bc06433..0603119b 100644 --- a/src/endpoints/get_trending_quests.rs +++ b/src/endpoints/get_trending_quests.rs @@ -20,7 +20,7 @@ pub struct GetTrendingQuestsQuery { addr: Option, } -#[route(get, "/get_trending_quests", crate::endpoints::get_trending_quests)] +#[route(get, "/get_trending_quests")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/has_completed_quest.rs b/src/endpoints/has_completed_quest.rs index 98c70a60..fc5cc00d 100644 --- a/src/endpoints/has_completed_quest.rs +++ b/src/endpoints/has_completed_quest.rs @@ -19,7 +19,7 @@ pub struct HasCompletedQuestsQuery { quest_id: u32, } -#[route(get, "/has_completed_quest", crate::endpoints::has_completed_quest)] +#[route(get, "/has_completed_quest")] pub async fn handler( State(state): State>, Query(query): Query, @@ -28,69 +28,69 @@ pub async fn handler( let quest_id = query.quest_id; let pipeline = vec![ doc! { - "$match": doc! { - "address": address, - } - }, + "$match": doc! { + "address": address, + } + }, doc! { - "$lookup": doc! { - "from": "tasks", - "localField": "task_id", - "foreignField": "id", - "as": "associatedTask" - } - }, + "$lookup": doc! { + "from": "tasks", + "localField": "task_id", + "foreignField": "id", + "as": "associatedTask" + } + }, doc! { - "$unwind": "$associatedTask" - }, + "$unwind": "$associatedTask" + }, doc! { - "$project": doc! { - "_id": 0, - "address": 1, - "task_id": 1, - "quest_id": "$associatedTask.quest_id" - } - }, + "$project": doc! { + "_id": 0, + "address": 1, + "task_id": 1, + "quest_id": "$associatedTask.quest_id" + } + }, doc! { - "$group": doc! { - "_id": "$quest_id", - "done": doc! { - "$sum": 1 + "$group": doc! { + "_id": "$quest_id", + "done": doc! { + "$sum": 1 + } } - } - }, + }, doc! { - "$match": doc! { - "_id": quest_id, - } - }, + "$match": doc! { + "_id": quest_id, + } + }, doc! { - "$lookup": doc! { - "from": "tasks", - "localField": "_id", - "foreignField": "quest_id", - "as": "tasks" - } - }, + "$lookup": doc! { + "from": "tasks", + "localField": "_id", + "foreignField": "quest_id", + "as": "tasks" + } + }, doc! { - "$project": doc! { - "_id": 0, - "result": doc! { - "$cond": doc! { - "if": doc! { - "$eq": [ - doc! { - "$size": "$tasks" - }, - "$done" - ] - }, - "then": true, - "else": false + "$project": doc! { + "_id": 0, + "result": doc! { + "$cond": doc! { + "if": doc! { + "$eq": [ + doc! { + "$size": "$tasks" + }, + "$done" + ] + }, + "then": true, + "else": false + } } } - } - }, + }, ]; let tasks_collection = state.db.collection::("completed_tasks"); match tasks_collection.aggregate(pipeline, None).await { diff --git a/src/endpoints/leaderboard/get_ranking.rs b/src/endpoints/leaderboard/get_ranking.rs index f4af5bf8..0fae00b8 100644 --- a/src/endpoints/leaderboard/get_ranking.rs +++ b/src/endpoints/leaderboard/get_ranking.rs @@ -237,8 +237,7 @@ pub struct GetCompletedQuestsQuery { #[route( get, - "/leaderboard/get_ranking", - crate::endpoints::leaderboard::get_ranking + "/leaderboard/get_ranking" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/leaderboard/get_static_info.rs b/src/endpoints/leaderboard/get_static_info.rs index dbaaf49a..a9901f15 100644 --- a/src/endpoints/leaderboard/get_static_info.rs +++ b/src/endpoints/leaderboard/get_static_info.rs @@ -36,8 +36,7 @@ pub struct GetLeaderboardInfoQuery { #[route( get, - "/leaderboard/get_static_info", - crate::endpoints::leaderboard::get_static_info + "/leaderboard/get_static_info" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/quest_boost/get_boost.rs b/src/endpoints/quest_boost/get_boost.rs index a2cb0b5b..7eca7f0c 100644 --- a/src/endpoints/quest_boost/get_boost.rs +++ b/src/endpoints/quest_boost/get_boost.rs @@ -17,7 +17,7 @@ pub struct GetQuestsQuery { id: u32, } -#[route(get, "/boost/get_boost", crate::endpoints::quest_boost::get_boost)] +#[route(get, "/boost/get_boost")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quest_boost/get_boosts.rs b/src/endpoints/quest_boost/get_boosts.rs index 074a9ea1..d6ea3912 100644 --- a/src/endpoints/quest_boost/get_boosts.rs +++ b/src/endpoints/quest_boost/get_boosts.rs @@ -10,7 +10,7 @@ use futures::StreamExt; use mongodb::bson::doc; use std::sync::Arc; -#[route(get, "/boost/get_boosts", crate::endpoints::quest_boost::get_boosts)] +#[route(get, "/boost/get_boosts")] pub async fn handler(State(state): State>) -> impl IntoResponse { let collection = state.db.collection::("boosts"); let mut boosts = match collection.find(doc! {"hidden":false}, None).await { diff --git a/src/endpoints/quest_boost/get_claim_params.rs b/src/endpoints/quest_boost/get_claim_params.rs index 5b0abe28..5f16f8d5 100644 --- a/src/endpoints/quest_boost/get_claim_params.rs +++ b/src/endpoints/quest_boost/get_claim_params.rs @@ -24,8 +24,7 @@ pub struct GetClaimBoostQuery { #[route( get, - "/boost/get_claim_params", - crate::endpoints::quest_boost::get_claim_params + "/boost/get_claim_params" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/quest_boost/get_completed_boosts.rs b/src/endpoints/quest_boost/get_completed_boosts.rs index db7b6b9d..0ab37027 100644 --- a/src/endpoints/quest_boost/get_completed_boosts.rs +++ b/src/endpoints/quest_boost/get_completed_boosts.rs @@ -21,8 +21,7 @@ pub struct GetCompletedQuestsQuery { #[route( get, - "/boost/get_completed_boosts", - crate::endpoints::quest_boost::get_completed_boosts + "/boost/get_completed_boosts" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/quest_boost/get_pending_claims.rs b/src/endpoints/quest_boost/get_pending_claims.rs index b4476272..0a1f760b 100644 --- a/src/endpoints/quest_boost/get_pending_claims.rs +++ b/src/endpoints/quest_boost/get_pending_claims.rs @@ -22,8 +22,7 @@ pub struct GetQuestsQuery { #[route( get, - "/boost/get_pending_claims", - crate::endpoints::quest_boost::get_pending_claims + "/boost/get_pending_claims" )] pub async fn handler( State(state): State>, diff --git a/src/endpoints/quest_boost/get_quests.rs b/src/endpoints/quest_boost/get_quests.rs index bbceb813..64dcb00a 100644 --- a/src/endpoints/quest_boost/get_quests.rs +++ b/src/endpoints/quest_boost/get_quests.rs @@ -18,7 +18,7 @@ pub struct GetQuestForBoostQuery { boost_id: u32, } -#[route(get, "/boost/get_quests", crate::endpoints::quest_boost::get_quests)] +#[route(get, "/boost/get_quests")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/avnu/claimable.rs b/src/endpoints/quests/avnu/claimable.rs index 7f79dd18..430fb73a 100644 --- a/src/endpoints/quests/avnu/claimable.rs +++ b/src/endpoints/quests/avnu/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/avnu/claimable", - crate::endpoints::quests::avnu::claimable -)] +#[route(get, "/quests/avnu/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/avnu/discord_fw_callback.rs b/src/endpoints/quests/avnu/discord_fw_callback.rs index c0ae5712..b18f55b5 100644 --- a/src/endpoints/quests/avnu/discord_fw_callback.rs +++ b/src/endpoints/quests/avnu/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/avnu/discord_fw_callback", - crate::endpoints::quests::avnu::discord_fw_callback -)] +#[route(get, "/quests/avnu/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/avnu/verify_swap.rs b/src/endpoints/quests/avnu/verify_swap.rs index ce50ca20..ea2bfb41 100644 --- a/src/endpoints/quests/avnu/verify_swap.rs +++ b/src/endpoints/quests/avnu/verify_swap.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/avnu/verify_swap", - crate::endpoints::quests::avnu::verify_swap -)] +#[route(get, "/quests/avnu/verify_swap")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/bountive/claimable.rs b/src/endpoints/quests/bountive/claimable.rs index 10fa0d2b..d41db696 100644 --- a/src/endpoints/quests/bountive/claimable.rs +++ b/src/endpoints/quests/bountive/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( -get, -"/quests/bountive/claimable", -crate::endpoints::quests::bountive::claimable -)] +#[route(get, "/quests/bountive/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -87,9 +83,9 @@ pub async fn handler( let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await - else { - return get_error("Signature failed".into()); - }; + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/bountive/verify_deposit.rs b/src/endpoints/quests/bountive/verify_deposit.rs index e2a069c6..8ace7ed2 100644 --- a/src/endpoints/quests/bountive/verify_deposit.rs +++ b/src/endpoints/quests/bountive/verify_deposit.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( -get, -"/quests/bountive/verify_deposit", -crate::endpoints::quests::bountive::verify_deposit -)] +#[route(get, "/quests/bountive/verify_deposit")] pub async fn handler( State(state): State>, Query(query): Query, @@ -43,7 +39,6 @@ pub async fn handler( ) .await; - match call_result { Ok(result) => { if result[0] == FieldElement::ZERO { diff --git a/src/endpoints/quests/bountive/verify_twitter_fw.rs b/src/endpoints/quests/bountive/verify_twitter_fw.rs index d1ccaa62..d087833a 100644 --- a/src/endpoints/quests/bountive/verify_twitter_fw.rs +++ b/src/endpoints/quests/bountive/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/bountive/verify_twitter_fw", -crate::endpoints::quests::bountive::verify_twitter_fw -)] +#[route(get, "/quests/bountive/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/bountive/verify_twitter_rt.rs b/src/endpoints/quests/bountive/verify_twitter_rt.rs index ad53bd5b..039ee1d7 100644 --- a/src/endpoints/quests/bountive/verify_twitter_rt.rs +++ b/src/endpoints/quests/bountive/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/bountive/verify_twitter_rt", -crate::endpoints::quests::bountive::verify_twitter_rt -)] +#[route(get, "/quests/bountive/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/claimable.rs b/src/endpoints/quests/braavos/avnu/claimable.rs index 39dd65da..f13ff13b 100644 --- a/src/endpoints/quests/braavos/avnu/claimable.rs +++ b/src/endpoints/quests/braavos/avnu/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/avnu/claimable", - crate::endpoints::quests::braavos::avnu::claimable -)] +#[route(get, "/quests/braavos/avnu/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/verify_has_domain.rs b/src/endpoints/quests/braavos/avnu/verify_has_domain.rs index 4e69684c..5aa2714a 100644 --- a/src/endpoints/quests/braavos/avnu/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/avnu/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/avnu/verify_has_domain", - crate::endpoints::quests::braavos::avnu::verify_has_domain -)] +#[route(get, "/quests/braavos/avnu/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/verify_swap.rs b/src/endpoints/quests/braavos/avnu/verify_swap.rs index c90bfe37..8fc088a1 100644 --- a/src/endpoints/quests/braavos/avnu/verify_swap.rs +++ b/src/endpoints/quests/braavos/avnu/verify_swap.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/avnu/verify_swap", - crate::endpoints::quests::braavos::avnu::verify_swap -)] +#[route(get, "/quests/braavos/avnu/verify_swap")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/verify_twitter_fw_avnu.rs b/src/endpoints/quests/braavos/avnu/verify_twitter_fw_avnu.rs index 5b944743..7911ffea 100644 --- a/src/endpoints/quests/braavos/avnu/verify_twitter_fw_avnu.rs +++ b/src/endpoints/quests/braavos/avnu/verify_twitter_fw_avnu.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/avnu/verify_twitter_fw_avnu", - crate::endpoints::quests::braavos::avnu::verify_twitter_fw_avnu -)] +#[route(get, "/quests/braavos/avnu/verify_twitter_fw_avnu")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/avnu/verify_twitter_fw_braavos.rs index 7ee374fe..b07b20ba 100644 --- a/src/endpoints/quests/braavos/avnu/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/avnu/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/avnu/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::avnu::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/avnu/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/avnu/verify_twitter_rt.rs b/src/endpoints/quests/braavos/avnu/verify_twitter_rt.rs index 7e7f8e9f..30102302 100644 --- a/src/endpoints/quests/braavos/avnu/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/avnu/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/avnu/verify_twitter_rt", - crate::endpoints::quests::braavos::avnu::verify_twitter_rt -)] +#[route(get, "/quests/braavos/avnu/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/carbonable/claimable.rs b/src/endpoints/quests/braavos/carbonable/claimable.rs index 2731d2ee..9bb41f3e 100644 --- a/src/endpoints/quests/braavos/carbonable/claimable.rs +++ b/src/endpoints/quests/braavos/carbonable/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/carbonable/claimable", - crate::endpoints::quests::braavos::carbonable::claimable -)] +#[route(get, "/quests/braavos/carbonable/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/carbonable/verify_deposit.rs b/src/endpoints/quests/braavos/carbonable/verify_deposit.rs index 3d29eff5..6696204e 100644 --- a/src/endpoints/quests/braavos/carbonable/verify_deposit.rs +++ b/src/endpoints/quests/braavos/carbonable/verify_deposit.rs @@ -18,18 +18,14 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/braavos/carbonable/verify_deposit", - crate::endpoints::quests::braavos::carbonable::verify_deposit -)] +#[route(get, "/quests/braavos/carbonable/verify_deposit")] pub async fn handler( State(state): State>, Query(query): Query, ) -> impl IntoResponse { let task_id = 130; let addr = &query.addr; - let calldata =vec![*addr]; + let calldata = vec![*addr]; let call_result = state .provider diff --git a/src/endpoints/quests/braavos/carbonable/verify_has_domain.rs b/src/endpoints/quests/braavos/carbonable/verify_has_domain.rs index 4bb9ec75..11d3e6f9 100644 --- a/src/endpoints/quests/braavos/carbonable/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/carbonable/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/carbonable/verify_has_domain", - crate::endpoints::quests::braavos::carbonable::verify_has_domain -)] +#[route(get, "/quests/braavos/carbonable/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_braavos.rs index caae8de2..9a5e6c55 100644 --- a/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/carbonable/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::carbonable::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/carbonable/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_carbonable.rs b/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_carbonable.rs index 8bb299e6..35a9bc19 100644 --- a/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_carbonable.rs +++ b/src/endpoints/quests/braavos/carbonable/verify_twitter_fw_carbonable.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/carbonable/verify_twitter_fw_carbonable", - crate::endpoints::quests::braavos::carbonable::verify_twitter_fw_carbonable -)] +#[route(get, "/quests/braavos/carbonable/verify_twitter_fw_carbonable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/carbonable/verify_twitter_rt.rs b/src/endpoints/quests/braavos/carbonable/verify_twitter_rt.rs index fceaea37..a0f32fae 100644 --- a/src/endpoints/quests/braavos/carbonable/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/carbonable/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/carbonable/verify_twitter_rt", - crate::endpoints::quests::braavos::carbonable::verify_twitter_rt -)] +#[route(get, "/quests/braavos/carbonable/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/myswap/claimable.rs b/src/endpoints/quests/braavos/myswap/claimable.rs index 4d76673c..e9226d82 100644 --- a/src/endpoints/quests/braavos/myswap/claimable.rs +++ b/src/endpoints/quests/braavos/myswap/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/myswap/claimable", - crate::endpoints::quests::braavos::myswap::claimable -)] +#[route(get, "/quests/braavos/myswap/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/myswap/verify_added_liquidity.rs b/src/endpoints/quests/braavos/myswap/verify_added_liquidity.rs index 98b79282..c49fff8b 100644 --- a/src/endpoints/quests/braavos/myswap/verify_added_liquidity.rs +++ b/src/endpoints/quests/braavos/myswap/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/braavos/myswap/verify_added_liquidity", - crate::endpoints::quests::braavos::myswap::verify_added_liquidity -)] +#[route(get, "/quests/braavos/myswap/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/myswap/verify_has_domain.rs b/src/endpoints/quests/braavos/myswap/verify_has_domain.rs index 378b1e74..821bf6ed 100644 --- a/src/endpoints/quests/braavos/myswap/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/myswap/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/myswap/verify_has_domain", - crate::endpoints::quests::braavos::myswap::verify_has_domain -)] +#[route(get, "/quests/braavos/myswap/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/myswap/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/myswap/verify_twitter_fw_braavos.rs index 83f3a740..bdbfd66a 100644 --- a/src/endpoints/quests/braavos/myswap/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/myswap/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/myswap/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::myswap::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/myswap/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/myswap/verify_twitter_fw_myswap.rs b/src/endpoints/quests/braavos/myswap/verify_twitter_fw_myswap.rs index 4d273433..c8127d19 100644 --- a/src/endpoints/quests/braavos/myswap/verify_twitter_fw_myswap.rs +++ b/src/endpoints/quests/braavos/myswap/verify_twitter_fw_myswap.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/myswap/verify_twitter_fw_myswap", - crate::endpoints::quests::braavos::myswap::verify_twitter_fw_myswap -)] +#[route(get, "/quests/braavos/myswap/verify_twitter_fw_myswap")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/claimable.rs b/src/endpoints/quests/braavos/pyramid/claimable.rs index 7e590125..58798182 100644 --- a/src/endpoints/quests/braavos/pyramid/claimable.rs +++ b/src/endpoints/quests/braavos/pyramid/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/pyramid/claimable", - crate::endpoints::quests::braavos::pyramid::claimable -)] +#[route(get, "/quests/braavos/pyramid/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/verify_buy_or_list.rs b/src/endpoints/quests/braavos/pyramid/verify_buy_or_list.rs index fdd05a40..5f031203 100644 --- a/src/endpoints/quests/braavos/pyramid/verify_buy_or_list.rs +++ b/src/endpoints/quests/braavos/pyramid/verify_buy_or_list.rs @@ -12,11 +12,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/pyramid/verify_buy_or_list", - crate::endpoints::quests::braavos::pyramid::verify_buy_or_list -)] +#[route(get, "/quests/braavos/pyramid/verify_buy_or_list")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/verify_has_domain.rs b/src/endpoints/quests/braavos/pyramid/verify_has_domain.rs index ab167faa..3beef652 100644 --- a/src/endpoints/quests/braavos/pyramid/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/pyramid/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/pyramid/verify_has_domain", - crate::endpoints::quests::braavos::pyramid::verify_has_domain -)] +#[route(get, "/quests/braavos/pyramid/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_braavos.rs index 10bd7f8f..ea2e4495 100644 --- a/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/pyramid/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::pyramid::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/pyramid/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_pyramid.rs b/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_pyramid.rs index 514e8ab9..e2cfb522 100644 --- a/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_pyramid.rs +++ b/src/endpoints/quests/braavos/pyramid/verify_twitter_fw_pyramid.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/pyramid/verify_twitter_fw_pyramid", - crate::endpoints::quests::braavos::pyramid::verify_twitter_fw_pyramid -)] +#[route(get, "/quests/braavos/pyramid/verify_twitter_fw_pyramid")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/pyramid/verify_twitter_rt.rs b/src/endpoints/quests/braavos/pyramid/verify_twitter_rt.rs index 781be8ad..0e7c3dfe 100644 --- a/src/endpoints/quests/braavos/pyramid/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/pyramid/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/pyramid/verify_twitter_rt", - crate::endpoints::quests::braavos::pyramid::verify_twitter_rt -)] +#[route(get, "/quests/braavos/pyramid/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/claimable.rs b/src/endpoints/quests/braavos/realms/claimable.rs index e20cb747..5f02ebec 100644 --- a/src/endpoints/quests/braavos/realms/claimable.rs +++ b/src/endpoints/quests/braavos/realms/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/realms/claimable", - crate::endpoints::quests::braavos::realms::claimable -)] +#[route(get, "/quests/braavos/realms/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/verify_has_domain.rs b/src/endpoints/quests/braavos/realms/verify_has_domain.rs index 79e7b3de..98f86abb 100644 --- a/src/endpoints/quests/braavos/realms/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/realms/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/realms/verify_has_domain", - crate::endpoints::quests::braavos::realms::verify_has_domain -)] +#[route(get, "/quests/braavos/realms/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/verify_has_played.rs b/src/endpoints/quests/braavos/realms/verify_has_played.rs index eff302ee..13bbeeb5 100644 --- a/src/endpoints/quests/braavos/realms/verify_has_played.rs +++ b/src/endpoints/quests/braavos/realms/verify_has_played.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/realms/verify_has_played", - crate::endpoints::quests::braavos::realms::verify_has_played -)] +#[route(get, "/quests/braavos/realms/verify_has_played")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/realms/verify_twitter_fw_braavos.rs index 97161c1e..c05ead00 100644 --- a/src/endpoints/quests/braavos/realms/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/realms/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/realms/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::realms::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/realms/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/verify_twitter_fw_realms.rs b/src/endpoints/quests/braavos/realms/verify_twitter_fw_realms.rs index 8f445342..413750c5 100644 --- a/src/endpoints/quests/braavos/realms/verify_twitter_fw_realms.rs +++ b/src/endpoints/quests/braavos/realms/verify_twitter_fw_realms.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/realms/verify_twitter_fw_realms", - crate::endpoints::quests::braavos::realms::verify_twitter_fw_realms -)] +#[route(get, "/quests/braavos/realms/verify_twitter_fw_realms")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/realms/verify_twitter_rt.rs b/src/endpoints/quests/braavos/realms/verify_twitter_rt.rs index 9cca9879..7bd2026a 100644 --- a/src/endpoints/quests/braavos/realms/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/realms/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/realms/verify_twitter_rt", - crate::endpoints::quests::braavos::realms::verify_twitter_rt -)] +#[route(get, "/quests/braavos/realms/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/claimable.rs b/src/endpoints/quests/braavos/starknetid/claimable.rs index d8d0b28f..cb7bde15 100644 --- a/src/endpoints/quests/braavos/starknetid/claimable.rs +++ b/src/endpoints/quests/braavos/starknetid/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/starknetid/claimable", - crate::endpoints::quests::braavos::starknetid::claimable -)] +#[route(get, "/quests/braavos/starknetid/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/verify_has_domain.rs b/src/endpoints/quests/braavos/starknetid/verify_has_domain.rs index c0e51dda..957b5acf 100644 --- a/src/endpoints/quests/braavos/starknetid/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/starknetid/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/starknetid/verify_has_domain", - crate::endpoints::quests::braavos::starknetid::verify_has_domain -)] +#[route(get, "/quests/braavos/starknetid/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/verify_has_mission.rs b/src/endpoints/quests/braavos/starknetid/verify_has_mission.rs index a82efa09..64b96921 100644 --- a/src/endpoints/quests/braavos/starknetid/verify_has_mission.rs +++ b/src/endpoints/quests/braavos/starknetid/verify_has_mission.rs @@ -25,11 +25,7 @@ pub struct DiscordUser { username: String, } -#[route( - get, - "/quests/braavos/starknetid/verify_has_mission", - crate::endpoints::quests::braavos::starknetid::verify_has_mission -)] +#[route(get, "/quests/braavos/starknetid/verify_has_mission")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_braavos.rs index 58e99fb8..139f874a 100644 --- a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/starknetid/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::starknetid::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/starknetid/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sid.rs b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sid.rs index 75ea9e81..843423d5 100644 --- a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sid.rs +++ b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sid.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/starknetid/verify_twitter_fw_sid", - crate::endpoints::quests::braavos::starknetid::verify_twitter_fw_sid -)] +#[route(get, "/quests/braavos/starknetid/verify_twitter_fw_sid")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sq.rs b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sq.rs index daecbe87..69c8883d 100644 --- a/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sq.rs +++ b/src/endpoints/quests/braavos/starknetid/verify_twitter_fw_sq.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/starknetid/verify_twitter_fw_sq", - crate::endpoints::quests::braavos::starknetid::verify_twitter_fw_sq -)] +#[route(get, "/quests/braavos/starknetid/verify_twitter_fw_sq")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/wallet/claimable.rs b/src/endpoints/quests/braavos/wallet/claimable.rs index 6bec7b80..172f3511 100644 --- a/src/endpoints/quests/braavos/wallet/claimable.rs +++ b/src/endpoints/quests/braavos/wallet/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/wallet/claimable", - crate::endpoints::quests::braavos::wallet::claimable -)] +#[route(get, "/quests/braavos/wallet/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/wallet/verify_has_domain.rs b/src/endpoints/quests/braavos/wallet/verify_has_domain.rs index ba2ea2d1..43a2910e 100644 --- a/src/endpoints/quests/braavos/wallet/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/wallet/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/wallet/verify_has_domain", - crate::endpoints::quests::braavos::wallet::verify_has_domain -)] +#[route(get, "/quests/braavos/wallet/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/wallet/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/wallet/verify_twitter_fw_braavos.rs index b33eee83..03c33b86 100644 --- a/src/endpoints/quests/braavos/wallet/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/wallet/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/wallet/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::wallet::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/wallet/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/wallet/verify_twitter_rt.rs b/src/endpoints/quests/braavos/wallet/verify_twitter_rt.rs index cc918f02..3c539ff6 100644 --- a/src/endpoints/quests/braavos/wallet/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/wallet/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/wallet/verify_twitter_rt", - crate::endpoints::quests::braavos::wallet::verify_twitter_rt -)] +#[route(get, "/quests/braavos/wallet/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/claimable.rs b/src/endpoints/quests/braavos/zklend/claimable.rs index 3dc6de8a..e4c3ec3a 100644 --- a/src/endpoints/quests/braavos/zklend/claimable.rs +++ b/src/endpoints/quests/braavos/zklend/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/braavos/zklend/claimable", - crate::endpoints::quests::braavos::zklend::claimable -)] +#[route(get, "/quests/braavos/zklend/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/verify_added_liquidity.rs b/src/endpoints/quests/braavos/zklend/verify_added_liquidity.rs index 21bc3eba..0eca71b6 100644 --- a/src/endpoints/quests/braavos/zklend/verify_added_liquidity.rs +++ b/src/endpoints/quests/braavos/zklend/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/braavos/zklend/verify_added_liquidity", - crate::endpoints::quests::braavos::zklend::verify_added_liquidity -)] +#[route(get, "/quests/braavos/zklend/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/verify_has_domain.rs b/src/endpoints/quests/braavos/zklend/verify_has_domain.rs index f504d1b2..1f9e73b8 100644 --- a/src/endpoints/quests/braavos/zklend/verify_has_domain.rs +++ b/src/endpoints/quests/braavos/zklend/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/braavos/zklend/verify_has_domain", - crate::endpoints::quests::braavos::zklend::verify_has_domain -)] +#[route(get, "/quests/braavos/zklend/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/verify_twitter_fw_braavos.rs b/src/endpoints/quests/braavos/zklend/verify_twitter_fw_braavos.rs index a6e27f93..dc62005c 100644 --- a/src/endpoints/quests/braavos/zklend/verify_twitter_fw_braavos.rs +++ b/src/endpoints/quests/braavos/zklend/verify_twitter_fw_braavos.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/zklend/verify_twitter_fw_braavos", - crate::endpoints::quests::braavos::zklend::verify_twitter_fw_braavos -)] +#[route(get, "/quests/braavos/zklend/verify_twitter_fw_braavos")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/verify_twitter_fw_zklend.rs b/src/endpoints/quests/braavos/zklend/verify_twitter_fw_zklend.rs index c782d357..fbcbe8b6 100644 --- a/src/endpoints/quests/braavos/zklend/verify_twitter_fw_zklend.rs +++ b/src/endpoints/quests/braavos/zklend/verify_twitter_fw_zklend.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/zklend/verify_twitter_fw_zklend", - crate::endpoints::quests::braavos::zklend::verify_twitter_fw_zklend -)] +#[route(get, "/quests/braavos/zklend/verify_twitter_fw_zklend")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/braavos/zklend/verify_twitter_rt.rs b/src/endpoints/quests/braavos/zklend/verify_twitter_rt.rs index 499ceb50..df5fa8ef 100644 --- a/src/endpoints/quests/braavos/zklend/verify_twitter_rt.rs +++ b/src/endpoints/quests/braavos/zklend/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/braavos/zklend/verify_twitter_rt", - crate::endpoints::quests::braavos::zklend::verify_twitter_rt -)] +#[route(get, "/quests/braavos/zklend/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/carmine/claimable.rs b/src/endpoints/quests/carmine/claimable.rs index 9ddc4d9e..016f2418 100644 --- a/src/endpoints/quests/carmine/claimable.rs +++ b/src/endpoints/quests/carmine/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/carmine/claimable", - crate::endpoints::quests::carmine::claimable -)] +#[route(get, "/quests/carmine/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/claimable.rs b/src/endpoints/quests/claimable.rs index a7aff4a5..7550212e 100644 --- a/src/endpoints/quests/claimable.rs +++ b/src/endpoints/quests/claimable.rs @@ -5,6 +5,8 @@ use axum::{ Json, }; +use crate::models::{Reward, RewardResponse}; +use crate::utils::get_nft; use axum_auto_routes::route; use futures::TryStreamExt; use mongodb::bson::{doc, Document}; @@ -13,8 +15,6 @@ use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use starknet::signers::{LocalWallet, SigningKey}; use std::sync::Arc; -use crate::models::{Reward, RewardResponse}; -use crate::utils::get_nft; #[derive(Debug, Serialize, Deserialize)] pub struct HasCompletedQuestsQuery { @@ -22,7 +22,7 @@ pub struct HasCompletedQuestsQuery { quest_id: u32, } -#[route(get, "/quests/claimable", crate::endpoints::quests::claimable)] +#[route(get, "/quests/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -153,11 +153,17 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = - get_nft(quest_id, last_task as u32, &query.addr, nft_level as u32, &signer).await - else { - return get_error("Signature failed".into()); - }; + let Ok((token_id, sig)) = get_nft( + quest_id, + last_task as u32, + &query.addr, + nft_level as u32, + &signer, + ) + .await + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: last_task as u32, diff --git a/src/endpoints/quests/contract_uri.rs b/src/endpoints/quests/contract_uri.rs index af09ebd5..b40f05a5 100644 --- a/src/endpoints/quests/contract_uri.rs +++ b/src/endpoints/quests/contract_uri.rs @@ -18,7 +18,7 @@ pub struct TokenURI { external_link: String, } -#[route(get, "/quests/contract_uri", crate::endpoints::quests::contract_uri)] +#[route(get, "/quests/contract_uri")] pub async fn handler(State(state): State>) -> Response { let response = TokenURI { name: "Starknet Quest".into(), diff --git a/src/endpoints/quests/discord_fw_callback.rs b/src/endpoints/quests/discord_fw_callback.rs index 15e1294e..ff6e69e3 100644 --- a/src/endpoints/quests/discord_fw_callback.rs +++ b/src/endpoints/quests/discord_fw_callback.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use crate::models::QuestTaskDocument; use crate::utils::CompletedTasksTrait; use crate::{ models::AppState, @@ -14,7 +15,6 @@ use mongodb::bson::doc; use reqwest::header::AUTHORIZATION; use serde::Deserialize; use starknet::core::types::FieldElement; -use crate::models::QuestTaskDocument; #[derive(Deserialize)] pub struct TwitterOAuthCallbackQuery { @@ -29,7 +29,7 @@ pub struct Guild { name: String, } -#[route(get, "/quests/discord_fw_callback", crate::endpoints::quests::discord_fw_callback)] +#[route(get, "/quests/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, @@ -42,7 +42,10 @@ pub async fn handler( let tasks_collection = state.db.collection::("tasks"); let task = tasks_collection - .find_one(doc! { "id": task_id,"quest_id":quest_id,"task_type":"discord" }, None) + .find_one( + doc! { "id": task_id,"quest_id":quest_id,"task_type":"discord" }, + None, + ) .await .unwrap() .unwrap(); @@ -144,14 +147,12 @@ async fn exchange_authorization_code( let json: serde_json::Value = res.json().await?; match json["access_token"].as_str() { Some(s) => Ok(s.to_string()), - None => { - Err(Box::new(std::io::Error::new( - std::io::ErrorKind::Other, - format!( - "Failed to get 'access_token' from JSON response : {:?}", - json - ), - ))) - } + None => Err(Box::new(std::io::Error::new( + std::io::ErrorKind::Other, + format!( + "Failed to get 'access_token' from JSON response : {:?}", + json + ), + ))), } } diff --git a/src/endpoints/quests/ekubo/claimable.rs b/src/endpoints/quests/ekubo/claimable.rs index df168f9d..d84819ea 100644 --- a/src/endpoints/quests/ekubo/claimable.rs +++ b/src/endpoints/quests/ekubo/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/ekubo/claimable", - crate::endpoints::quests::ekubo::claimable -)] +#[route(get, "/quests/ekubo/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/ekubo/discord_fw_callback.rs b/src/endpoints/quests/ekubo/discord_fw_callback.rs index 82a784a4..b5e41e23 100644 --- a/src/endpoints/quests/ekubo/discord_fw_callback.rs +++ b/src/endpoints/quests/ekubo/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/ekubo/discord_fw_callback", - crate::endpoints::quests::ekubo::discord_fw_callback -)] +#[route(get, "/quests/ekubo/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/ekubo/verify_added_liquidity.rs b/src/endpoints/quests/ekubo/verify_added_liquidity.rs index 1a798715..0be198a1 100644 --- a/src/endpoints/quests/ekubo/verify_added_liquidity.rs +++ b/src/endpoints/quests/ekubo/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/ekubo/verify_added_liquidity", - crate::endpoints::quests::ekubo::verify_added_liquidity -)] +#[route(get, "/quests/ekubo/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/briq/claimable.rs b/src/endpoints/quests/element/briq/claimable.rs index d198ab07..c6942189 100644 --- a/src/endpoints/quests/element/briq/claimable.rs +++ b/src/endpoints/quests/element/briq/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/element/briq/claimable", - crate::endpoints::quests::element::briq::claimable -)] +#[route(get, "/quests/element/briq/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/briq/verify_own_briq.rs b/src/endpoints/quests/element/briq/verify_own_briq.rs index 98bcb512..2d1b648c 100644 --- a/src/endpoints/quests/element/briq/verify_own_briq.rs +++ b/src/endpoints/quests/element/briq/verify_own_briq.rs @@ -15,11 +15,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/element/briq/verify_own_briq", - crate::endpoints::quests::element::briq::verify_own_briq -)] +#[route(get, "/quests/element/briq/verify_own_briq")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/briq/verify_twitter_fw.rs b/src/endpoints/quests/element/briq/verify_twitter_fw.rs index 6e10acd0..09c40e23 100644 --- a/src/endpoints/quests/element/briq/verify_twitter_fw.rs +++ b/src/endpoints/quests/element/briq/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/element/briq/verify_twitter_fw", - crate::endpoints::quests::element::briq::verify_twitter_fw -)] +#[route(get, "/quests/element/briq/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/element/claimable.rs b/src/endpoints/quests/element/element/claimable.rs index 590a8828..3f5803e8 100644 --- a/src/endpoints/quests/element/element/claimable.rs +++ b/src/endpoints/quests/element/element/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/element/element/claimable", - crate::endpoints::quests::element::element::claimable -)] +#[route(get, "/quests/element/element/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/element/verify_is_eligible.rs b/src/endpoints/quests/element/element/verify_is_eligible.rs index 23fb09c6..3d7e3888 100644 --- a/src/endpoints/quests/element/element/verify_is_eligible.rs +++ b/src/endpoints/quests/element/element/verify_is_eligible.rs @@ -22,11 +22,7 @@ pub struct ElementResponse { data: bool, } -#[route( - get, - "/quests/element/element/verify_is_eligible", - crate::endpoints::quests::element::element::verify_is_eligible -)] +#[route(get, "/quests/element/element/verify_is_eligible")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/element/verify_twitter_fw.rs b/src/endpoints/quests/element/element/verify_twitter_fw.rs index 0ff98ce5..3bea9954 100644 --- a/src/endpoints/quests/element/element/verify_twitter_fw.rs +++ b/src/endpoints/quests/element/element/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/element/element/verify_twitter_fw", - crate::endpoints::quests::element::element::verify_twitter_fw -)] +#[route(get, "/quests/element/element/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/layerswap/claimable.rs b/src/endpoints/quests/element/layerswap/claimable.rs index 38c22e77..35a1995a 100644 --- a/src/endpoints/quests/element/layerswap/claimable.rs +++ b/src/endpoints/quests/element/layerswap/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/element/layerswap/claimable", - crate::endpoints::quests::element::layerswap::claimable -)] +#[route(get, "/quests/element/layerswap/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/layerswap/verify_has_bridged.rs b/src/endpoints/quests/element/layerswap/verify_has_bridged.rs index f31eb2c5..e4b49b08 100644 --- a/src/endpoints/quests/element/layerswap/verify_has_bridged.rs +++ b/src/endpoints/quests/element/layerswap/verify_has_bridged.rs @@ -30,11 +30,7 @@ struct LayerswapError { message: String, } -#[route( - get, - "/quests/element/layerswap/verify_has_bridged", - crate::endpoints::quests::element::layerswap::verify_has_bridged -)] +#[route(get, "/quests/element/layerswap/verify_has_bridged")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/layerswap/verify_twitter_fw.rs b/src/endpoints/quests/element/layerswap/verify_twitter_fw.rs index 68c1cc1f..d29bfa97 100644 --- a/src/endpoints/quests/element/layerswap/verify_twitter_fw.rs +++ b/src/endpoints/quests/element/layerswap/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/element/layerswap/verify_twitter_fw", - crate::endpoints::quests::element::layerswap::verify_twitter_fw -)] +#[route(get, "/quests/element/layerswap/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/layerswap/verify_twitter_rt.rs b/src/endpoints/quests/element/layerswap/verify_twitter_rt.rs index 43e7de21..43edc25a 100644 --- a/src/endpoints/quests/element/layerswap/verify_twitter_rt.rs +++ b/src/endpoints/quests/element/layerswap/verify_twitter_rt.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/element/layerswap/verify_twitter_rt", - crate::endpoints::quests::element::layerswap::verify_twitter_rt -)] +#[route(get, "/quests/element/layerswap/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/starknetid/claimable.rs b/src/endpoints/quests/element/starknetid/claimable.rs index 22de2f23..f0e500fd 100644 --- a/src/endpoints/quests/element/starknetid/claimable.rs +++ b/src/endpoints/quests/element/starknetid/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/element/starknetid/claimable", - crate::endpoints::quests::element::starknetid::claimable -)] +#[route(get, "/quests/element/starknetid/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/element/starknetid/verify_has_root_domain.rs b/src/endpoints/quests/element/starknetid/verify_has_root_domain.rs index 81eb4bab..15d57b20 100644 --- a/src/endpoints/quests/element/starknetid/verify_has_root_domain.rs +++ b/src/endpoints/quests/element/starknetid/verify_has_root_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/element/starknetid/verify_has_root_domain", - crate::endpoints::quests::element::starknetid::verify_has_root_domain -)] +#[route(get, "/quests/element/starknetid/verify_has_root_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/focustree/engagement/discord_fw_callback.rs b/src/endpoints/quests/focustree/engagement/discord_fw_callback.rs index 857a8257..847b9004 100644 --- a/src/endpoints/quests/focustree/engagement/discord_fw_callback.rs +++ b/src/endpoints/quests/focustree/engagement/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/focustree/discord_fw_callback", - crate::endpoints::quests::focustree::engagement::discord_fw_callback -)] +#[route(get, "/quests/focustree/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/focustree/engagement/verify_twitter_rt.rs b/src/endpoints/quests/focustree/engagement/verify_twitter_rt.rs index 49ca8383..9d60c852 100644 --- a/src/endpoints/quests/focustree/engagement/verify_twitter_rt.rs +++ b/src/endpoints/quests/focustree/engagement/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/focustree/verify_twitter_rw_user", - crate::endpoints::quests::focustree::engagement::verify_twitter_rt -)] +#[route(get, "/quests/focustree/verify_twitter_rw_user")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/focustree/introduction/claimable.rs b/src/endpoints/quests/focustree/introduction/claimable.rs index 550568f0..769b205b 100644 --- a/src/endpoints/quests/focustree/introduction/claimable.rs +++ b/src/endpoints/quests/focustree/introduction/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/focustree/claimable", - crate::endpoints::quests::focustree::introduction::claimable -)] +#[route(get, "/quests/focustree/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/focustree/introduction/verify_twitter_fw.rs b/src/endpoints/quests/focustree/introduction/verify_twitter_fw.rs index e4d866d5..36ab6d8b 100644 --- a/src/endpoints/quests/focustree/introduction/verify_twitter_fw.rs +++ b/src/endpoints/quests/focustree/introduction/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/focustree/verify_twitter_fw", - crate::endpoints::quests::focustree::introduction::verify_twitter_fw -)] +#[route(get, "/quests/focustree/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/focustree/introduction/verify_twitter_rt.rs b/src/endpoints/quests/focustree/introduction/verify_twitter_rt.rs index a2d6de6b..25071270 100644 --- a/src/endpoints/quests/focustree/introduction/verify_twitter_rt.rs +++ b/src/endpoints/quests/focustree/introduction/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/focustree/verify_twitter_rt", - crate::endpoints::quests::focustree::introduction::verify_twitter_rt -)] +#[route(get, "/quests/focustree/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/haiko/claimable.rs b/src/endpoints/quests/haiko/claimable.rs index fa2043fc..72cc9d4a 100644 --- a/src/endpoints/quests/haiko/claimable.rs +++ b/src/endpoints/quests/haiko/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( -get, -"/quests/haiko/claimable", -crate::endpoints::quests::haiko::claimable -)] +#[route(get, "/quests/haiko/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -87,9 +83,9 @@ pub async fn handler( let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await - else { - return get_error("Signature failed".into()); - }; + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/haiko/verify_deposit.rs b/src/endpoints/quests/haiko/verify_deposit.rs index 18dfcc84..375e46cb 100644 --- a/src/endpoints/quests/haiko/verify_deposit.rs +++ b/src/endpoints/quests/haiko/verify_deposit.rs @@ -14,11 +14,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/haiko/verify_deposit", -crate::endpoints::quests::haiko::verify_deposit -)] +#[route(get, "/quests/haiko/verify_deposit")] pub async fn handler( State(state): State>, Query(query): Query, @@ -35,7 +31,13 @@ pub async fn handler( match fetch_json_from_url(url).await { Ok(response) => { // check if user has deposited his funds - let response_data = response.get("data").unwrap().get("result").unwrap().as_bool().unwrap(); + let response_data = response + .get("data") + .unwrap() + .get("result") + .unwrap() + .as_bool() + .unwrap(); return if response_data { match state.upsert_completed_task(query.addr, task_id).await { Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(), diff --git a/src/endpoints/quests/haiko/verify_twitter_fw.rs b/src/endpoints/quests/haiko/verify_twitter_fw.rs index 1947031f..d629ec05 100644 --- a/src/endpoints/quests/haiko/verify_twitter_fw.rs +++ b/src/endpoints/quests/haiko/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/haiko/verify_twitter_fw", -crate::endpoints::quests::haiko::verify_twitter_fw -)] +#[route(get, "/quests/haiko/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/haiko/verify_twitter_rw.rs b/src/endpoints/quests/haiko/verify_twitter_rw.rs index 18fe4c68..3c1dc780 100644 --- a/src/endpoints/quests/haiko/verify_twitter_rw.rs +++ b/src/endpoints/quests/haiko/verify_twitter_rw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/haiko/verify_twitter_rt", -crate::endpoints::quests::haiko::verify_twitter_rw -)] +#[route(get, "/quests/haiko/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/hashstack/claimable.rs b/src/endpoints/quests/hashstack/claimable.rs index 80592420..0a538fdd 100644 --- a/src/endpoints/quests/hashstack/claimable.rs +++ b/src/endpoints/quests/hashstack/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( -get, -"/quests/hashstack/claimable", -crate::endpoints::quests::hashstack::claimable -)] +#[route(get, "/quests/hashstack/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -87,9 +83,9 @@ pub async fn handler( let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await - else { - return get_error("Signature failed".into()); - }; + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/hashstack/discord_fw_callback.rs b/src/endpoints/quests/hashstack/discord_fw_callback.rs index 8d6e7195..20e91ee9 100644 --- a/src/endpoints/quests/hashstack/discord_fw_callback.rs +++ b/src/endpoints/quests/hashstack/discord_fw_callback.rs @@ -28,12 +28,7 @@ pub struct Guild { name: String, } -#[route( -get, -"/quests/hashstack/discord_fw_callback", -crate::endpoints::quests::hashstack::discord_fw_callback - -)] +#[route(get, "/quests/hashstack/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/hashstack/verify_deposit.rs b/src/endpoints/quests/hashstack/verify_deposit.rs index 29b7e1c0..30434092 100644 --- a/src/endpoints/quests/hashstack/verify_deposit.rs +++ b/src/endpoints/quests/hashstack/verify_deposit.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( -get, -"/quests/hashstack/verify_deposit", -crate::endpoints::quests::hashstack::verify_deposit -)] +#[route(get, "/quests/hashstack/verify_deposit")] pub async fn handler( State(state): State>, Query(query): Query, @@ -44,7 +40,6 @@ pub async fn handler( ) .await; - match call_result { Ok(result) => { if result[0] < FieldElement::from_dec_str("1000000000").unwrap() { diff --git a/src/endpoints/quests/hashstack/verify_has_domain.rs b/src/endpoints/quests/hashstack/verify_has_domain.rs index 49717b4d..a1a4d463 100644 --- a/src/endpoints/quests/hashstack/verify_has_domain.rs +++ b/src/endpoints/quests/hashstack/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( -get, -"/quests/hashstack/verify_has_domain", -crate::endpoints::quests::hashstack::verify_has_domain -)] +#[route(get, "/quests/hashstack/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/hashstack/verify_twitter_fw_hashstack.rs b/src/endpoints/quests/hashstack/verify_twitter_fw_hashstack.rs index 8876d4fe..d84c3827 100644 --- a/src/endpoints/quests/hashstack/verify_twitter_fw_hashstack.rs +++ b/src/endpoints/quests/hashstack/verify_twitter_fw_hashstack.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/hashstack/verify_twitter_fw", -crate::endpoints::quests::hashstack::verify_twitter_fw_hashstack -)] +#[route(get, "/quests/hashstack/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/hashstack/verify_twitter_rw.rs b/src/endpoints/quests/hashstack/verify_twitter_rw.rs index d59a4ec3..639768c0 100644 --- a/src/endpoints/quests/hashstack/verify_twitter_rw.rs +++ b/src/endpoints/quests/hashstack/verify_twitter_rw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/hashstack/verify_twitter_rt", -crate::endpoints::quests::hashstack::verify_twitter_rw -)] +#[route(get, "/quests/hashstack/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/influence/claimable.rs b/src/endpoints/quests/influence/claimable.rs index 2a4a9dfe..61a4d9ed 100644 --- a/src/endpoints/quests/influence/claimable.rs +++ b/src/endpoints/quests/influence/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( -get, -"/quests/influence/claimable", -crate::endpoints::quests::influence::claimable -)] +#[route(get, "/quests/influence/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -87,9 +83,9 @@ pub async fn handler( let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await - else { - return get_error("Signature failed".into()); - }; + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/influence/discord_fw_callback.rs b/src/endpoints/quests/influence/discord_fw_callback.rs index c928560d..b1e0731f 100644 --- a/src/endpoints/quests/influence/discord_fw_callback.rs +++ b/src/endpoints/quests/influence/discord_fw_callback.rs @@ -28,12 +28,7 @@ pub struct Guild { name: String, } -#[route( -get, -"/quests/influence/discord_fw_callback", -crate::endpoints::quests::influence::discord_fw_callback - -)] +#[route(get, "/quests/influence/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/influence/verify_twitter_fw.rs b/src/endpoints/quests/influence/verify_twitter_fw.rs index acdf2366..574c3270 100644 --- a/src/endpoints/quests/influence/verify_twitter_fw.rs +++ b/src/endpoints/quests/influence/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/influence/verify_twitter_fw", -crate::endpoints::quests::influence::verify_twitter_fw -)] +#[route(get, "/quests/influence/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/influence/verify_twitter_rw.rs b/src/endpoints/quests/influence/verify_twitter_rw.rs index a4a882f4..41a86c40 100644 --- a/src/endpoints/quests/influence/verify_twitter_rw.rs +++ b/src/endpoints/quests/influence/verify_twitter_rw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/influence/verify_twitter_rw", -crate::endpoints::quests::influence::verify_twitter_rw -)] +#[route(get, "/quests/influence/verify_twitter_rw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/influence/verify_twitter_rw_2.rs b/src/endpoints/quests/influence/verify_twitter_rw_2.rs index b2e18972..f7c4e6c6 100644 --- a/src/endpoints/quests/influence/verify_twitter_rw_2.rs +++ b/src/endpoints/quests/influence/verify_twitter_rw_2.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/influence/verify_twitter_rw_2", -crate::endpoints::quests::influence::verify_twitter_rw_2 -)] +#[route(get, "/quests/influence/verify_twitter_rw_2")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/jediswap/claimable.rs b/src/endpoints/quests/jediswap/claimable.rs index 0b82b5ae..f853722f 100644 --- a/src/endpoints/quests/jediswap/claimable.rs +++ b/src/endpoints/quests/jediswap/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/jediswap/claimable", - crate::endpoints::quests::jediswap::claimable -)] +#[route(get, "/quests/jediswap/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/jediswap/verify_added_liquidity.rs b/src/endpoints/quests/jediswap/verify_added_liquidity.rs index 101c2609..2bd9f1ca 100644 --- a/src/endpoints/quests/jediswap/verify_added_liquidity.rs +++ b/src/endpoints/quests/jediswap/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/jediswap/verify_added_liquidity", - crate::endpoints::quests::jediswap::verify_added_liquidity -)] +#[route(get, "/quests/jediswap/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/jediswap/verify_twitter_fw.rs b/src/endpoints/quests/jediswap/verify_twitter_fw.rs index 09a01933..50a99a10 100644 --- a/src/endpoints/quests/jediswap/verify_twitter_fw.rs +++ b/src/endpoints/quests/jediswap/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/jediswap/verify_twitter_fw", - crate::endpoints::quests::jediswap::verify_twitter_fw -)] +#[route(get, "/quests/jediswap/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/jediswap/verify_twitter_rt.rs b/src/endpoints/quests/jediswap/verify_twitter_rt.rs index 5f9ea58a..9bbf1b83 100644 --- a/src/endpoints/quests/jediswap/verify_twitter_rt.rs +++ b/src/endpoints/quests/jediswap/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/jediswap/verify_twitter_rt", - crate::endpoints::quests::jediswap::verify_twitter_rt -)] +#[route(get, "/quests/jediswap/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/morphine/claimable.rs b/src/endpoints/quests/morphine/claimable.rs index 1644751d..2b6e4750 100644 --- a/src/endpoints/quests/morphine/claimable.rs +++ b/src/endpoints/quests/morphine/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/morphine/claimable", - crate::endpoints::quests::morphine::claimable -)] +#[route(get, "/quests/morphine/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/morphine/verify_added_liquidity.rs b/src/endpoints/quests/morphine/verify_added_liquidity.rs index 37cfcea3..cc7c9945 100644 --- a/src/endpoints/quests/morphine/verify_added_liquidity.rs +++ b/src/endpoints/quests/morphine/verify_added_liquidity.rs @@ -35,11 +35,7 @@ lazy_static::lazy_static! { ]; } -#[route( - get, - "/quests/morphine/verify_added_liquidity", - crate::endpoints::quests::morphine::verify_added_liquidity -)] +#[route(get, "/quests/morphine/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/myswap/claimable.rs b/src/endpoints/quests/myswap/claimable.rs index e6d56294..434d07e2 100644 --- a/src/endpoints/quests/myswap/claimable.rs +++ b/src/endpoints/quests/myswap/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/myswap/claimable", - crate::endpoints::quests::myswap::claimable -)] +#[route(get, "/quests/myswap/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/myswap/discord_fw_callback.rs b/src/endpoints/quests/myswap/discord_fw_callback.rs index 88346a75..238acab9 100644 --- a/src/endpoints/quests/myswap/discord_fw_callback.rs +++ b/src/endpoints/quests/myswap/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/myswap/discord_fw_callback", - crate::endpoints::quests::myswap::discord_fw_callback -)] +#[route(get, "/quests/myswap/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/myswap/verify_added_liquidity.rs b/src/endpoints/quests/myswap/verify_added_liquidity.rs index d8a00924..d4b3a8ea 100644 --- a/src/endpoints/quests/myswap/verify_added_liquidity.rs +++ b/src/endpoints/quests/myswap/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/myswap/verify_added_liquidity", - crate::endpoints::quests::myswap::verify_added_liquidity -)] +#[route(get, "/quests/myswap/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nimbora/check_balance.rs b/src/endpoints/quests/nimbora/check_balance.rs index 82fa9736..0c769f36 100644 --- a/src/endpoints/quests/nimbora/check_balance.rs +++ b/src/endpoints/quests/nimbora/check_balance.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( -get, -"/quests/nimbora/check_balance", -crate::endpoints::quests::nimbora::check_balance -)] +#[route(get, "/quests/nimbora/check_balance")] pub async fn handler( State(state): State>, Query(query): Query, @@ -42,7 +38,6 @@ pub async fn handler( ) .await; - match call_result { Ok(result) => { if result[0] < FieldElement::from_dec_str("4000000000000000").unwrap() { diff --git a/src/endpoints/quests/nimbora/claimable.rs b/src/endpoints/quests/nimbora/claimable.rs index cf4885f4..5ae2c1cf 100644 --- a/src/endpoints/quests/nimbora/claimable.rs +++ b/src/endpoints/quests/nimbora/claimable.rs @@ -17,7 +17,7 @@ use starknet::{ use std::sync::Arc; const QUEST_ID: u32 = 22; -const TASK_IDS: &[u32] = &[89, 90, 91,144]; +const TASK_IDS: &[u32] = &[89, 90, 91, 144]; const LAST_TASK: u32 = TASK_IDS[3]; const NFT_LEVEL: u32 = 35; @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/nimbora/claimable", - crate::endpoints::quests::nimbora::claimable -)] +#[route(get, "/quests/nimbora/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nimbora/discord_fw_callback.rs b/src/endpoints/quests/nimbora/discord_fw_callback.rs index f496c8ec..9682e3ce 100644 --- a/src/endpoints/quests/nimbora/discord_fw_callback.rs +++ b/src/endpoints/quests/nimbora/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/nimbora/discord_fw_callback", - crate::endpoints::quests::nimbora::discord_fw_callback -)] +#[route(get, "/quests/nimbora/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, @@ -151,5 +147,3 @@ async fn exchange_authorization_code( } } } - - diff --git a/src/endpoints/quests/nimbora/verify_twitter_rt.rs b/src/endpoints/quests/nimbora/verify_twitter_rt.rs index 2e4d7e8a..aef54222 100644 --- a/src/endpoints/quests/nimbora/verify_twitter_rt.rs +++ b/src/endpoints/quests/nimbora/verify_twitter_rt.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/nimbora/verify_twitter_rt", - crate::endpoints::quests::nimbora::verify_twitter_rt -)] +#[route(get, "/quests/nimbora/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nostra/liquidity_quest/claimable.rs b/src/endpoints/quests/nostra/liquidity_quest/claimable.rs index b1f51590..b1ce2a19 100644 --- a/src/endpoints/quests/nostra/liquidity_quest/claimable.rs +++ b/src/endpoints/quests/nostra/liquidity_quest/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/nostra/claimable", - crate::endpoints::quests::nostra::liquidity_quest::claimable -)] +#[route(get, "/quests/nostra/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -85,9 +81,11 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await else { + let Ok((token_id, sig)) = + get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await + else { return get_error("Signature failed".into()); - }; + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/nostra/liquidity_quest/discord_fw_callback.rs b/src/endpoints/quests/nostra/liquidity_quest/discord_fw_callback.rs index e6c390cf..6b16b3fa 100644 --- a/src/endpoints/quests/nostra/liquidity_quest/discord_fw_callback.rs +++ b/src/endpoints/quests/nostra/liquidity_quest/discord_fw_callback.rs @@ -28,12 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/nostra/discord_fw_callback", - crate::endpoints::quests::nostra::liquidity_quest::discord_fw_callback - -)] +#[route(get, "/quests/nostra/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nostra/liquidity_quest/verify_added_liquidity.rs b/src/endpoints/quests/nostra/liquidity_quest/verify_added_liquidity.rs index 9e4fade1..f700ddbb 100644 --- a/src/endpoints/quests/nostra/liquidity_quest/verify_added_liquidity.rs +++ b/src/endpoints/quests/nostra/liquidity_quest/verify_added_liquidity.rs @@ -18,12 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/nostra/verify_added_liquidity", - crate::endpoints::quests::nostra::liquidity_quest::verify_added_liquidity - -)] +#[route(get, "/quests/nostra/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nostra/staking_quest/claimable.rs b/src/endpoints/quests/nostra/staking_quest/claimable.rs index deefbda0..263307e0 100644 --- a/src/endpoints/quests/nostra/staking_quest/claimable.rs +++ b/src/endpoints/quests/nostra/staking_quest/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/nostra/staking_quest/claimable", - crate::endpoints::quests::nostra::staking_quest::claimable -)] +#[route(get, "/quests/nostra/staking_quest/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -85,9 +81,11 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await else { + let Ok((token_id, sig)) = + get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await + else { return get_error("Signature failed".into()); - }; + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/nostra/staking_quest/verify_stake.rs b/src/endpoints/quests/nostra/staking_quest/verify_stake.rs index dc19c53d..6ea2042e 100644 --- a/src/endpoints/quests/nostra/staking_quest/verify_stake.rs +++ b/src/endpoints/quests/nostra/staking_quest/verify_stake.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( -get, -"/quests/nostra/staking_quest/verify_stake", -crate::endpoints::quests::nostra::staking_quest::verify_stake -)] +#[route(get, "/quests/nostra/staking_quest/verify_stake")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/nostra/staking_quest/verify_twitter_tw.rs b/src/endpoints/quests/nostra/staking_quest/verify_twitter_tw.rs index 93a8bad7..e61000e4 100644 --- a/src/endpoints/quests/nostra/staking_quest/verify_twitter_tw.rs +++ b/src/endpoints/quests/nostra/staking_quest/verify_twitter_tw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/nostra/staking_quest/verify_twitter_tw", -crate::endpoints::quests::nostra::staking_quest::verify_twitter_tw -)] +#[route(get, "/quests/nostra/staking_quest/verify_twitter_tw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/claimable.rs b/src/endpoints/quests/orbiter/claimable.rs index ba1ee945..fc13c732 100644 --- a/src/endpoints/quests/orbiter/claimable.rs +++ b/src/endpoints/quests/orbiter/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/orbiter/claimable", - crate::endpoints::quests::orbiter::claimable -)] +#[route(get, "/quests/orbiter/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/verify_has_bridged.rs b/src/endpoints/quests/orbiter/verify_has_bridged.rs index 5acf212b..a66b1b02 100644 --- a/src/endpoints/quests/orbiter/verify_has_bridged.rs +++ b/src/endpoints/quests/orbiter/verify_has_bridged.rs @@ -29,11 +29,7 @@ struct Response { data: Data, } -#[route( - get, - "/quests/orbiter/verify_has_bridged", - crate::endpoints::quests::orbiter::verify_has_bridged -)] +#[route(get, "/quests/orbiter/verify_has_bridged")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/verify_has_root_domain.rs b/src/endpoints/quests/orbiter/verify_has_root_domain.rs index e1250063..892f47e1 100644 --- a/src/endpoints/quests/orbiter/verify_has_root_domain.rs +++ b/src/endpoints/quests/orbiter/verify_has_root_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/orbiter/verify_has_root_domain", - crate::endpoints::quests::orbiter::verify_has_root_domain -)] +#[route(get, "/quests/orbiter/verify_has_root_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/verify_twitter_fw.rs b/src/endpoints/quests/orbiter/verify_twitter_fw.rs index 6fa56416..3c13075d 100644 --- a/src/endpoints/quests/orbiter/verify_twitter_fw.rs +++ b/src/endpoints/quests/orbiter/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/orbiter/verify_twitter_fw", - crate::endpoints::quests::orbiter::verify_twitter_fw -)] +#[route(get, "/quests/orbiter/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs b/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs index b6711ee9..7df24c79 100644 --- a/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs +++ b/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/orbiter/verify_twitter_fw_sq", - crate::endpoints::quests::orbiter::verify_twitter_fw_sq -)] +#[route(get, "/quests/orbiter/verify_twitter_fw_sq")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/orbiter/verify_twitter_rt.rs b/src/endpoints/quests/orbiter/verify_twitter_rt.rs index ac0cc2f3..be8b9cc8 100644 --- a/src/endpoints/quests/orbiter/verify_twitter_rt.rs +++ b/src/endpoints/quests/orbiter/verify_twitter_rt.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/orbiter/verify_twitter_rt", - crate::endpoints::quests::orbiter::verify_twitter_rt -)] +#[route(get, "/quests/orbiter/verify_twitter_rt")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest1/check_trade.rs b/src/endpoints/quests/rango/quest1/check_trade.rs index 1e6a7ca6..b1c4c968 100644 --- a/src/endpoints/quests/rango/quest1/check_trade.rs +++ b/src/endpoints/quests/rango/quest1/check_trade.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::models::VerifyQuery; -use crate::utils::{to_hex, CompletedTasksTrait, make_api_request}; +use crate::utils::{make_api_request, to_hex, CompletedTasksTrait}; use crate::{models::AppState, utils::get_error}; use axum::{ extract::{Query, State}, @@ -12,11 +12,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/rango/check_trade", -crate::endpoints::quests::rango::quest1::check_trade -)] +#[route(get, "/quests/rango/check_trade")] pub async fn handler( State(state): State>, Query(query): Query, @@ -42,7 +38,7 @@ pub async fn handler( &address_hex, Some(&state.conf.rango.api_key), ) - .await; + .await; match res { true => { @@ -51,8 +47,6 @@ pub async fn handler( Err(e) => get_error(format!("{}", e)), }; } - false => { - get_error("User has not completed the task".to_string()) - } + false => get_error("User has not completed the task".to_string()), } -} \ No newline at end of file +} diff --git a/src/endpoints/quests/rango/quest1/claimable.rs b/src/endpoints/quests/rango/quest1/claimable.rs index 110df2c0..ff95930a 100644 --- a/src/endpoints/quests/rango/quest1/claimable.rs +++ b/src/endpoints/quests/rango/quest1/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/rango/claimable", - crate::endpoints::quests::rango::quest1::claimable -)] +#[route(get, "/quests/rango/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -85,7 +81,9 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await else { + let Ok((token_id, sig)) = + get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await + else { return get_error("Signature failed".into()); }; @@ -104,4 +102,4 @@ pub async fn handler( } Err(_) => get_error("Error querying rewards".into()), } -} \ No newline at end of file +} diff --git a/src/endpoints/quests/rango/quest1/discord_fw_callback.rs b/src/endpoints/quests/rango/quest1/discord_fw_callback.rs index 5740ac6d..e69e6c36 100644 --- a/src/endpoints/quests/rango/quest1/discord_fw_callback.rs +++ b/src/endpoints/quests/rango/quest1/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/rango/discord_fw_callback", - crate::endpoints::quests::rango::quest1::discord_fw_callback -)] +#[route(get, "/quests/rango/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest1/verify_twitter_fw.rs b/src/endpoints/quests/rango/quest1/verify_twitter_fw.rs index b37f9dcb..af72764e 100644 --- a/src/endpoints/quests/rango/quest1/verify_twitter_fw.rs +++ b/src/endpoints/quests/rango/quest1/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rango/verify_twitter_fw", - crate::endpoints::quests::rango::quest1::verify_twitter_fw -)] +#[route(get, "/quests/rango/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest2/check_trade.rs b/src/endpoints/quests/rango/quest2/check_trade.rs index dbe04d4a..c2ef1243 100644 --- a/src/endpoints/quests/rango/quest2/check_trade.rs +++ b/src/endpoints/quests/rango/quest2/check_trade.rs @@ -12,11 +12,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rango/quest2/check_trade", - crate::endpoints::quests::rango::quest2::check_trade -)] +#[route(get, "/quests/rango/quest2/check_trade")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest2/claimable.rs b/src/endpoints/quests/rango/quest2/claimable.rs index ddae9703..4bee0685 100644 --- a/src/endpoints/quests/rango/quest2/claimable.rs +++ b/src/endpoints/quests/rango/quest2/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/rango/quest2/claimable", - crate::endpoints::quests::rango::quest2::claimable -)] +#[route(get, "/quests/rango/quest2/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -85,7 +81,9 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await else { + let Ok((token_id, sig)) = + get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await + else { return get_error("Signature failed".into()); }; @@ -104,4 +102,4 @@ pub async fn handler( } Err(_) => get_error("Error querying rewards".into()), } -} \ No newline at end of file +} diff --git a/src/endpoints/quests/rango/quest2/discord_fw_callback.rs b/src/endpoints/quests/rango/quest2/discord_fw_callback.rs index b8bd38f6..1c59db12 100644 --- a/src/endpoints/quests/rango/quest2/discord_fw_callback.rs +++ b/src/endpoints/quests/rango/quest2/discord_fw_callback.rs @@ -28,11 +28,7 @@ pub struct Guild { name: String, } -#[route( - get, - "/quests/rango/quest2/discord_fw_callback", - crate::endpoints::quests::rango::quest2::discord_fw_callback -)] +#[route(get, "/quests/rango/quest2/discord_fw_callback")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest2/verify_twitter_fw.rs b/src/endpoints/quests/rango/quest2/verify_twitter_fw.rs index a0f5cae4..9e4c53ae 100644 --- a/src/endpoints/quests/rango/quest2/verify_twitter_fw.rs +++ b/src/endpoints/quests/rango/quest2/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rango/quest2/verify_twitter_fw", - crate::endpoints::quests::rango::quest2::verify_twitter_fw -)] +#[route(get, "/quests/rango/quest2/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rango/quest2/verify_twitter_rw.rs b/src/endpoints/quests/rango/quest2/verify_twitter_rw.rs index f7c23b38..a75d196f 100644 --- a/src/endpoints/quests/rango/quest2/verify_twitter_rw.rs +++ b/src/endpoints/quests/rango/quest2/verify_twitter_rw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( -get, -"/quests/rango/quest2/verify_twitter_rw", -crate::endpoints::quests::rango::quest2::verify_twitter_rw -)] +#[route(get, "/quests/rango/quest2/verify_twitter_rw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rhino/check_bridge.rs b/src/endpoints/quests/rhino/check_bridge.rs index 80a2b784..e8f9686a 100644 --- a/src/endpoints/quests/rhino/check_bridge.rs +++ b/src/endpoints/quests/rhino/check_bridge.rs @@ -14,11 +14,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rhino/check_bridge", - crate::endpoints::quests::rhino::check_bridge -)] +#[route(get, "/quests/rhino/check_bridge")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rhino/claimable.rs b/src/endpoints/quests/rhino/claimable.rs index ef570dac..e4943262 100644 --- a/src/endpoints/quests/rhino/claimable.rs +++ b/src/endpoints/quests/rhino/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/rhino/claimable", - crate::endpoints::quests::rhino::claimable -)] +#[route(get, "/quests/rhino/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -85,7 +81,9 @@ pub async fn handler( let mut rewards = vec![]; - let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await else { + let Ok((token_id, sig)) = + get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await + else { return get_error("Signature failed".into()); }; diff --git a/src/endpoints/quests/rhino/verify_twitter_fw.rs b/src/endpoints/quests/rhino/verify_twitter_fw.rs index 992f0a7d..6345d62b 100644 --- a/src/endpoints/quests/rhino/verify_twitter_fw.rs +++ b/src/endpoints/quests/rhino/verify_twitter_fw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rhino/verify_twitter_fw", - crate::endpoints::quests::rhino::verify_twitter_fw -)] +#[route(get, "/quests/rhino/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/rhino/verify_twitter_rw.rs b/src/endpoints/quests/rhino/verify_twitter_rw.rs index 600ba5a8..6f865989 100644 --- a/src/endpoints/quests/rhino/verify_twitter_rw.rs +++ b/src/endpoints/quests/rhino/verify_twitter_rw.rs @@ -13,11 +13,7 @@ use axum::{ use axum_auto_routes::route; use serde_json::json; -#[route( - get, - "/quests/rhino/verify_twitter_rw", - crate::endpoints::quests::rhino::verify_twitter_rw -)] +#[route(get, "/quests/rhino/verify_twitter_rw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest1/claimable.rs b/src/endpoints/quests/sithswap/quest1/claimable.rs index f532f5c1..2afcc5e7 100644 --- a/src/endpoints/quests/sithswap/quest1/claimable.rs +++ b/src/endpoints/quests/sithswap/quest1/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/sithswap/claimable", - crate::endpoints::quests::sithswap::quest1::claimable -)] +#[route(get, "/quests/sithswap/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest1/verify_added_liquidity.rs b/src/endpoints/quests/sithswap/quest1/verify_added_liquidity.rs index 621eee55..d764d475 100644 --- a/src/endpoints/quests/sithswap/quest1/verify_added_liquidity.rs +++ b/src/endpoints/quests/sithswap/quest1/verify_added_liquidity.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/sithswap/verify_added_liquidity", - crate::endpoints::quests::sithswap::quest1::verify_added_liquidity -)] +#[route(get, "/quests/sithswap/verify_added_liquidity")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest1/verify_twitter_fw.rs b/src/endpoints/quests/sithswap/quest1/verify_twitter_fw.rs index 7303ad20..b0a1df18 100644 --- a/src/endpoints/quests/sithswap/quest1/verify_twitter_fw.rs +++ b/src/endpoints/quests/sithswap/quest1/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/sithswap/verify_twitter_fw", - crate::endpoints::quests::sithswap::quest1::verify_twitter_fw -)] +#[route(get, "/quests/sithswap/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest2/claimable.rs b/src/endpoints/quests/sithswap/quest2/claimable.rs index 00d97ba8..ef19e008 100644 --- a/src/endpoints/quests/sithswap/quest2/claimable.rs +++ b/src/endpoints/quests/sithswap/quest2/claimable.rs @@ -17,7 +17,7 @@ use starknet::{ use std::sync::Arc; const QUEST_ID: u32 = 31; -const TASK_IDS: &[u32] = &[149, 150, 151,152]; +const TASK_IDS: &[u32] = &[149, 150, 151, 152]; const LAST_TASK: u32 = TASK_IDS[3]; const NFT_LEVEL: u32 = 43; @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( -get, -"/quests/sithswap2/claimable", -crate::endpoints::quests::sithswap::quest2::claimable -)] +#[route(get, "/quests/sithswap2/claimable")] pub async fn handler( State(state): State>, Query(query): Query, @@ -87,9 +83,9 @@ pub async fn handler( let Ok((token_id, sig)) = get_nft(QUEST_ID, LAST_TASK, &query.addr, NFT_LEVEL, &signer).await - else { - return get_error("Signature failed".into()); - }; + else { + return get_error("Signature failed".into()); + }; rewards.push(Reward { task_id: LAST_TASK, diff --git a/src/endpoints/quests/sithswap/quest2/verify_deposit.rs b/src/endpoints/quests/sithswap/quest2/verify_deposit.rs index dfe9e4f7..012cfd8b 100644 --- a/src/endpoints/quests/sithswap/quest2/verify_deposit.rs +++ b/src/endpoints/quests/sithswap/quest2/verify_deposit.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use crate::utils::to_hex; use crate::{ models::{AppState, VerifyQuery}, utils::{get_error, CompletedTasksTrait}, @@ -12,17 +13,12 @@ use axum::{ }; use axum_auto_routes::route; use serde_json::json; -use crate::utils::to_hex; fn string_to_float(s: &str) -> Result { s.parse::() } -#[route( -get, -"/quests/sithswap2/verify_deposit", -crate::endpoints::quests::sithswap::quest2::verify_deposit -)] +#[route(get, "/quests/sithswap2/verify_deposit")] pub async fn handler( State(state): State>, Query(query): Query, @@ -46,7 +42,6 @@ pub async fn handler( hex_addr.insert(0, 'x'); hex_addr.insert(0, '0'); - // Define the GraphQL query let graphql_query = format!( r#" @@ -63,7 +58,7 @@ pub async fn handler( "#, &hex_addr ); - + // Send the GraphQL query let response = reqwest::Client::new() .post(endpoint) @@ -96,7 +91,7 @@ pub async fn handler( if let Some(amount_usd) = mint.get("amountUSD").and_then(|v| v.as_str()) { match string_to_float(amount_usd) { Ok(amount_usd) => total_amount_usd += amount_usd, - Err(_e) => return get_error(format!("Failed to get balance")) + Err(_e) => return get_error(format!("Failed to get balance")), } } } diff --git a/src/endpoints/quests/sithswap/quest2/verify_has_domain.rs b/src/endpoints/quests/sithswap/quest2/verify_has_domain.rs index 45d82d30..e2bc6367 100644 --- a/src/endpoints/quests/sithswap/quest2/verify_has_domain.rs +++ b/src/endpoints/quests/sithswap/quest2/verify_has_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( -get, -"/quests/sithswap2/verify_has_domain", -crate::endpoints::quests::sithswap::quest2::verify_has_domain -)] +#[route(get, "/quests/sithswap2/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest2/verify_twitter_fw.rs b/src/endpoints/quests/sithswap/quest2/verify_twitter_fw.rs index 80177beb..15be71cb 100644 --- a/src/endpoints/quests/sithswap/quest2/verify_twitter_fw.rs +++ b/src/endpoints/quests/sithswap/quest2/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( -get, -"/quests/sithswap2/verify_twitter_fw", -crate::endpoints::quests::sithswap::quest2::verify_twitter_fw -)] +#[route(get, "/quests/sithswap2/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/sithswap/quest2/verify_twitter_rw.rs b/src/endpoints/quests/sithswap/quest2/verify_twitter_rw.rs index ccffec4c..6c3453a2 100644 --- a/src/endpoints/quests/sithswap/quest2/verify_twitter_rw.rs +++ b/src/endpoints/quests/sithswap/quest2/verify_twitter_rw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( -get, -"/quests/sithswap2/verify_twitter_rw", -crate::endpoints::quests::sithswap::quest2::verify_twitter_rw -)] +#[route(get, "/quests/sithswap2/verify_twitter_rw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknet/aa_mastery/claimable.rs b/src/endpoints/quests/starknet/aa_mastery/claimable.rs index 90f35a13..29f87d89 100644 --- a/src/endpoints/quests/starknet/aa_mastery/claimable.rs +++ b/src/endpoints/quests/starknet/aa_mastery/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/starknet/aa_mastery/claimable", - crate::endpoints::quests::starknet::aa_mastery::claimable -)] +#[route(get, "/quests/starknet/aa_mastery/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknet/gigabrain/claimable.rs b/src/endpoints/quests/starknet/gigabrain/claimable.rs index 9847f24b..863ec973 100644 --- a/src/endpoints/quests/starknet/gigabrain/claimable.rs +++ b/src/endpoints/quests/starknet/gigabrain/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/starknet/gigabrain/claimable", - crate::endpoints::quests::starknet::gigabrain::claimable -)] +#[route(get, "/quests/starknet/gigabrain/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknetid/claimable.rs b/src/endpoints/quests/starknetid/claimable.rs index be4b6397..c072c2fb 100644 --- a/src/endpoints/quests/starknetid/claimable.rs +++ b/src/endpoints/quests/starknetid/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/starknetid/claimable", - crate::endpoints::quests::starknetid::claimable -)] +#[route(get, "/quests/starknetid/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknetid/verify_has_domain.rs b/src/endpoints/quests/starknetid/verify_has_domain.rs index 746d46d5..43c6a3af 100644 --- a/src/endpoints/quests/starknetid/verify_has_domain.rs +++ b/src/endpoints/quests/starknetid/verify_has_domain.rs @@ -25,11 +25,7 @@ pub struct StarknetIdQuery { addr: FieldElement, } -#[route( - get, - "/quests/starknetid/verify_has_domain", - crate::endpoints::quests::starknetid::verify_has_domain -)] +#[route(get, "/quests/starknetid/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknetid/verify_has_root_domain.rs b/src/endpoints/quests/starknetid/verify_has_root_domain.rs index f854b023..158ac185 100644 --- a/src/endpoints/quests/starknetid/verify_has_root_domain.rs +++ b/src/endpoints/quests/starknetid/verify_has_root_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/starknetid/verify_has_root_domain", - crate::endpoints::quests::starknetid::verify_has_root_domain -)] +#[route(get, "/quests/starknetid/verify_has_root_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknetid/verify_socials.rs b/src/endpoints/quests/starknetid/verify_socials.rs index 10f3686b..0c994a6d 100644 --- a/src/endpoints/quests/starknetid/verify_socials.rs +++ b/src/endpoints/quests/starknetid/verify_socials.rs @@ -38,11 +38,7 @@ async fn call_contract_helper( result.map_err(|e| format!("{}", e)) } -#[route( - get, - "/quests/starknetid/verify_socials", - crate::endpoints::quests::starknetid::verify_socials -)] +#[route(get, "/quests/starknetid/verify_socials")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/starknetid/verify_twitter_fw.rs b/src/endpoints/quests/starknetid/verify_twitter_fw.rs index 8a3b2b34..8b3ddf1f 100644 --- a/src/endpoints/quests/starknetid/verify_twitter_fw.rs +++ b/src/endpoints/quests/starknetid/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/starknetid/verify_twitter_follow", - crate::endpoints::quests::starknetid::verify_twitter_fw -)] +#[route(get, "/quests/starknetid/verify_twitter_follow")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/strk_farm/check_balance.rs b/src/endpoints/quests/strk_farm/check_balance.rs index 9f1db064..d3a18c57 100644 --- a/src/endpoints/quests/strk_farm/check_balance.rs +++ b/src/endpoints/quests/strk_farm/check_balance.rs @@ -15,11 +15,7 @@ use serde_json::json; type StrkFarmAPIResponse = serde_json::Value; -#[route( - get, - "/quests/strkFarm/check_balance", - crate::endpoints::quests::strk_farm::check_balance -)] +#[route(get, "/quests/strkFarm/check_balance")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/tribe/claimable.rs b/src/endpoints/quests/tribe/claimable.rs index fb3d9aef..352e8f12 100644 --- a/src/endpoints/quests/tribe/claimable.rs +++ b/src/endpoints/quests/tribe/claimable.rs @@ -49,11 +49,7 @@ pub struct ClaimableQuery { const QUEST_ID: u32 = 4; -#[route( - get, - "/quests/tribe/claimable", - crate::endpoints::quests::tribe::claimable -)] +#[route(get, "/quests/tribe/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/tribe/verify_has_domain.rs b/src/endpoints/quests/tribe/verify_has_domain.rs index a8ddc72d..3b97ed48 100644 --- a/src/endpoints/quests/tribe/verify_has_domain.rs +++ b/src/endpoints/quests/tribe/verify_has_domain.rs @@ -25,11 +25,7 @@ pub struct StarknetIdQuery { addr: FieldElement, } -#[route( - get, - "/quests/tribe/verify_has_domain", - crate::endpoints::quests::tribe::verify_has_domain -)] +#[route(get, "/quests/tribe/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/tribe/verify_has_root_domain.rs b/src/endpoints/quests/tribe/verify_has_root_domain.rs index 3823d986..8cc471a7 100644 --- a/src/endpoints/quests/tribe/verify_has_root_domain.rs +++ b/src/endpoints/quests/tribe/verify_has_root_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( - get, - "/quests/tribe/verify_has_root_domain", - crate::endpoints::quests::tribe::verify_has_root_domain -)] +#[route(get, "/quests/tribe/verify_has_root_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/tribe/verify_three_years_expiry.rs b/src/endpoints/quests/tribe/verify_three_years_expiry.rs index d0979df7..22531e46 100644 --- a/src/endpoints/quests/tribe/verify_three_years_expiry.rs +++ b/src/endpoints/quests/tribe/verify_three_years_expiry.rs @@ -28,11 +28,7 @@ pub struct StarknetIdQuery { addr: FieldElement, } -#[route( - get, - "/quests/tribe/verify_three_years_expiry", - crate::endpoints::quests::tribe::verify_three_years_expiry -)] +#[route(get, "/quests/tribe/verify_three_years_expiry")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/uri.rs b/src/endpoints/quests/uri.rs index 26577aa1..0a2bd163 100644 --- a/src/endpoints/quests/uri.rs +++ b/src/endpoints/quests/uri.rs @@ -7,10 +7,10 @@ use axum::{ Json, }; use axum_auto_routes::route; -use serde::{Deserialize, Serialize}; -use std::sync::Arc; use futures::StreamExt; use mongodb::bson::{doc, from_document}; +use serde::{Deserialize, Serialize}; +use std::sync::Arc; #[derive(Serialize)] pub struct TokenURI { @@ -20,7 +20,7 @@ pub struct TokenURI { attributes: Option>, } -#[derive(Serialize,Deserialize)] +#[derive(Serialize, Deserialize)] pub struct Attribute { trait_type: String, value: u32, @@ -31,7 +31,7 @@ pub struct LevelQuery { level: Option, } -#[route(get, "/quests/uri", crate::endpoints::quests::uri)] +#[route(get, "/quests/uri")] pub async fn handler( State(state): State>, Query(level_query): Query, @@ -41,13 +41,11 @@ pub async fn handler( .and_then(|level_str| level_str.parse::().ok()); let uri_collection = state.db.collection::("nft_uri"); - let pipeline = vec![ - doc! { - "$match":{ - "id":&level.unwrap() - } + let pipeline = vec![doc! { + "$match":{ + "id":&level.unwrap() } - ]; + }]; match uri_collection.aggregate(pipeline, None).await { Ok(mut cursor) => { @@ -55,13 +53,19 @@ pub async fn handler( return match result { Ok(document) => { if let Ok(nft_uri) = from_document::(document) { - return (StatusCode::OK, - Json(TokenURI { - name: (&*nft_uri.name).to_string(), - description: (&*nft_uri.description).to_string(), - image: format!("{}{}", state.conf.variables.app_link, &*nft_uri.image), - attributes: None, - })).into_response() + return ( + StatusCode::OK, + Json(TokenURI { + name: (&*nft_uri.name).to_string(), + description: (&*nft_uri.description).to_string(), + image: format!( + "{}{}", + state.conf.variables.app_link, &*nft_uri.image + ), + attributes: None, + }), + ) + .into_response(); } get_error("Error querying NFT URI".to_string()) } diff --git a/src/endpoints/quests/verify_balance.rs b/src/endpoints/quests/verify_balance.rs index fcddb0b1..b20207e1 100644 --- a/src/endpoints/quests/verify_balance.rs +++ b/src/endpoints/quests/verify_balance.rs @@ -26,11 +26,7 @@ pub struct VerifyBalanceQuery { pub task_id: u32, } -#[route( - get, - "/quests/verify_balance", - crate::endpoints::quests::verify_balance -)] +#[route(get, "/quests/verify_balance")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/verify_domain.rs b/src/endpoints/quests/verify_domain.rs index 06ceead6..5bc01bdc 100644 --- a/src/endpoints/quests/verify_domain.rs +++ b/src/endpoints/quests/verify_domain.rs @@ -9,11 +9,7 @@ use axum::{ use axum_auto_routes::route; use std::sync::Arc; -#[route( -get, -"/quests/verify_has_domain", -crate::endpoints::quests::verify_domain -)] +#[route(get, "/quests/verify_has_domain")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/verify_quiz.rs b/src/endpoints/quests/verify_quiz.rs index abe76727..cafca730 100644 --- a/src/endpoints/quests/verify_quiz.rs +++ b/src/endpoints/quests/verify_quiz.rs @@ -13,7 +13,7 @@ use mongodb::bson::doc; use serde_json::json; use starknet::core::types::FieldElement; -#[route(post, "/quests/verify_quiz", crate::endpoints::quests::verify_quiz)] +#[route(post, "/quests/verify_quiz")] pub async fn handler( State(state): State>, body: Json, diff --git a/src/endpoints/quests/verify_twitter_fw.rs b/src/endpoints/quests/verify_twitter_fw.rs index a406b2c2..2f421251 100644 --- a/src/endpoints/quests/verify_twitter_fw.rs +++ b/src/endpoints/quests/verify_twitter_fw.rs @@ -1,7 +1,8 @@ use std::sync::Arc; +use crate::models::{QuestTaskDocument, VerifyNewQuery}; use crate::{ - models::{AppState}, + models::AppState, utils::{get_error, CompletedTasksTrait}, }; use axum::{ @@ -11,31 +12,24 @@ use axum::{ Json, }; use axum_auto_routes::route; -use futures::{ TryStreamExt}; +use futures::TryStreamExt; use mongodb::bson::doc; use serde_json::json; -use crate::models::{QuestTaskDocument, VerifyNewQuery}; -#[route( -get, -"/quests/verify_twitter_fw", -crate::endpoints::quests::verify_twitter_fw -)] +#[route(get, "/quests/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, ) -> impl IntoResponse { let quest_id = query.quest_id; let task_id = query.task_id; - let pipeline = vec![ - doc! { - "$match": doc! { - "quest_id": quest_id, - "id":task_id , - "task_type": "twitter_fw" - } - }, - ]; + let pipeline = vec![doc! { + "$match": doc! { + "quest_id": quest_id, + "id":task_id , + "task_type": "twitter_fw" + } + }]; let tasks_collection = state.db.collection::("tasks"); match tasks_collection.aggregate(pipeline, None).await { diff --git a/src/endpoints/quests/verify_twitter_rw.rs b/src/endpoints/quests/verify_twitter_rw.rs index c2bcb298..bf950713 100644 --- a/src/endpoints/quests/verify_twitter_rw.rs +++ b/src/endpoints/quests/verify_twitter_rw.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use crate::models::{QuestTaskDocument, VerifyNewQuery}; use crate::{ - models::{AppState}, + models::AppState, utils::{get_error, CompletedTasksTrait}, }; use axum::{ @@ -16,11 +16,7 @@ use futures::TryStreamExt; use mongodb::bson::doc; use serde_json::json; -#[route( - get, - "/quests/verify_twitter_rw", - crate::endpoints::quests::verify_twitter_rw -)] +#[route(get, "/quests/verify_twitter_rw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/zklend/claimable.rs b/src/endpoints/quests/zklend/claimable.rs index ade12f90..7a57a922 100644 --- a/src/endpoints/quests/zklend/claimable.rs +++ b/src/endpoints/quests/zklend/claimable.rs @@ -26,11 +26,7 @@ pub struct ClaimableQuery { addr: FieldElement, } -#[route( - get, - "/quests/zklend/claimable", - crate::endpoints::quests::zklend::claimable -)] +#[route(get, "/quests/zklend/claimable")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/zklend/verify_borrow.rs b/src/endpoints/quests/zklend/verify_borrow.rs index b9d2870d..fe07d7c6 100644 --- a/src/endpoints/quests/zklend/verify_borrow.rs +++ b/src/endpoints/quests/zklend/verify_borrow.rs @@ -18,11 +18,7 @@ use starknet::{ providers::Provider, }; -#[route( - get, - "/quests/zklend/verify_borrow", - crate::endpoints::quests::zklend::verify_borrow -)] +#[route(get, "/quests/zklend/verify_borrow")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/quests/zklend/verify_twitter_fw.rs b/src/endpoints/quests/zklend/verify_twitter_fw.rs index dfd509c5..9c6eee95 100644 --- a/src/endpoints/quests/zklend/verify_twitter_fw.rs +++ b/src/endpoints/quests/zklend/verify_twitter_fw.rs @@ -14,11 +14,7 @@ use axum_auto_routes::route; use serde_json::json; use starknet::core::types::FieldElement; -#[route( - get, - "/quests/zklend/verify_twitter_fw", - crate::endpoints::quests::zklend::verify_twitter_fw -)] +#[route(get, "/quests/zklend/verify_twitter_fw")] pub async fn handler( State(state): State>, Query(query): Query, diff --git a/src/endpoints/unique_page_visit.rs b/src/endpoints/unique_page_visit.rs index 170728ef..d658b00d 100644 --- a/src/endpoints/unique_page_visit.rs +++ b/src/endpoints/unique_page_visit.rs @@ -1,7 +1,5 @@ -use crate::{ - models::{AppState}, - utils::get_error, -}; +use crate::models::UniquePageVisit; +use crate::{models::AppState, utils::get_error}; use axum::{ extract::{Query, State}, http::StatusCode, @@ -9,22 +7,21 @@ use axum::{ Json, }; use axum_auto_routes::route; -use mongodb::bson::doc; -use serde::Deserialize; -use std::sync::Arc; +use axum_client_ip::InsecureClientIp; use chrono::Utc; -use mongodb::Collection; +use mongodb::bson::doc; use mongodb::options::UpdateOptions; +use mongodb::Collection; +use serde::Deserialize; use serde_json::json; -use crate::models::UniquePageVisit; -use axum_client_ip::InsecureClientIp; +use std::sync::Arc; #[derive(Deserialize)] pub struct GetQuestsQuery { page_id: String, } -#[route(get, "/unique_page_visit", crate::endpoints::unique_page_visit)] +#[route(get, "/unique_page_visit")] pub async fn handler( insecure_ip: InsecureClientIp, State(state): State>, @@ -39,9 +36,11 @@ pub async fn handler( let update = doc! { "$setOnInsert": { "viewer_ip": addr.to_string(), "viewed_page_id": &id,"timestamp":created_at } }; let options = UpdateOptions::builder().upsert(true).build(); - match unique_viewers_collection.update_one(filter, update, options) - .await { + match unique_viewers_collection + .update_one(filter, update, options) + .await + { Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(), Err(_) => get_error("unable to detect page visit status".to_string()), } -} \ No newline at end of file +}