diff --git a/src/endpoints/quests/example/mod.rs b/src/endpoints/quests/example/mod.rs deleted file mode 100644 index 75e273d2..00000000 --- a/src/endpoints/quests/example/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod verify_quiz; diff --git a/src/endpoints/quests/example/verify_quiz.rs b/src/endpoints/quests/example/verify_quiz.rs deleted file mode 100644 index cf527f22..00000000 --- a/src/endpoints/quests/example/verify_quiz.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::sync::Arc; - -use crate::{ - common::verify_quiz::verify_quiz, - models::{AppState, VerifyQuizQuery}, - utils::{get_error, CompletedTasksTrait}, -}; -use axum::{extract::State, http::StatusCode, response::IntoResponse, Json}; -use serde_json::json; -use starknet::core::types::FieldElement; - -pub async fn handler( - State(state): State>, - body: Json, -) -> impl IntoResponse { - let task_id = 999; - if body.addr == FieldElement::ZERO { - return get_error("Please connect your wallet first".to_string()); - } - - let user_answers_numbers: Result>, _> = body - .user_answers_list - .iter() - .map(|inner_list| { - inner_list - .iter() - .map(|s| s.parse::()) - .collect::, _>>() - }) - .collect(); - - match user_answers_numbers { - Ok(responses) => match verify_quiz(&state.conf, body.addr, &body.quiz_name, &responses) { - true => match state.upsert_completed_task(body.addr, task_id).await { - Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(), - Err(e) => get_error(format!("{}", e)), - }, - false => get_error("Incorrect answers".to_string()), - }, - Err(e) => get_error(format!("{}", e)), - } -} diff --git a/src/endpoints/quests/mod.rs b/src/endpoints/quests/mod.rs index c0f0ce26..9abf7ea1 100644 --- a/src/endpoints/quests/mod.rs +++ b/src/endpoints/quests/mod.rs @@ -1,5 +1,4 @@ pub mod contract_uri; -pub mod example; pub mod orbiter; pub mod sithswap; pub mod starknetid; diff --git a/src/main.rs b/src/main.rs index f026ec37..78ab25e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,7 @@ mod common; mod config; mod endpoints; mod models; -use axum::{ - http::StatusCode, - routing::{get, post}, - Router, -}; +use axum::{http::StatusCode, routing::get, Router}; use mongodb::{bson::doc, options::ClientOptions, Client}; use reqwest::{Proxy, Url}; use starknet::providers::SequencerGatewayProvider; @@ -155,10 +151,6 @@ async fn main() { "/quests/orbiter/claimable", get(endpoints::quests::orbiter::claimable::handler), ) - .route( - "/quests/example/verify_quiz", - post(endpoints::quests::example::verify_quiz::handler), - ) .route( "/achievements/verify_default", get(endpoints::achievements::verify_default::handler), diff --git a/src/utils.rs b/src/utils.rs index 18969716..7addc432 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,4 @@ -use crate::{ - endpoints::achievements, - models::{AchievementDocument, AppState, CompletedTasks}, -}; +use crate::models::{AchievementDocument, AppState, CompletedTasks}; use async_trait::async_trait; use axum::{ http::StatusCode,