From 66b786617c45e5e0550082f30eb94490d08add8a Mon Sep 17 00:00:00 2001 From: Iris Date: Thu, 3 Aug 2023 13:35:40 +0200 Subject: [PATCH] feat: add task verify_twitter_fw_sq to orbiter quest --- src/endpoints/quests/orbiter/claimable.rs | 4 ++-- src/endpoints/quests/orbiter/mod.rs | 1 + .../quests/orbiter/verify_twitter_fw_sq.rs | 24 +++++++++++++++++++ .../quests/orbiter/verify_twitter_rt.rs | 2 +- src/main.rs | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs diff --git a/src/endpoints/quests/orbiter/claimable.rs b/src/endpoints/quests/orbiter/claimable.rs index abfd87df..6e01e9cc 100644 --- a/src/endpoints/quests/orbiter/claimable.rs +++ b/src/endpoints/quests/orbiter/claimable.rs @@ -16,8 +16,8 @@ use starknet::{ use std::sync::Arc; const QUEST_ID: u32 = 8; -const TASK_IDS: &[u32] = &[32, 33, 34, 35]; -const LAST_TASK: u32 = TASK_IDS[3]; +const TASK_IDS: &[u32] = &[32, 33, 34, 35, 36]; +const LAST_TASK: u32 = TASK_IDS[4]; const NFT_LEVEL: u32 = 10; #[derive(Deserialize)] diff --git a/src/endpoints/quests/orbiter/mod.rs b/src/endpoints/quests/orbiter/mod.rs index aecdc6aa..267f5e51 100644 --- a/src/endpoints/quests/orbiter/mod.rs +++ b/src/endpoints/quests/orbiter/mod.rs @@ -2,4 +2,5 @@ pub mod claimable; pub mod verify_has_bridged; pub mod verify_has_root_domain; pub mod verify_twitter_fw; +pub mod verify_twitter_fw_sq; pub mod verify_twitter_rt; diff --git a/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs b/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs new file mode 100644 index 00000000..74583587 --- /dev/null +++ b/src/endpoints/quests/orbiter/verify_twitter_fw_sq.rs @@ -0,0 +1,24 @@ +use std::sync::Arc; + +use crate::{ + models::{AppState, VerifyQuery}, + utils::{get_error, CompletedTasksTrait}, +}; +use axum::{ + extract::{Query, State}, + http::StatusCode, + response::IntoResponse, + Json, +}; +use serde_json::json; + +pub async fn handler( + State(state): State>, + Query(query): Query, +) -> impl IntoResponse { + let task_id = 35; + match state.upsert_completed_task(query.addr, task_id).await { + Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(), + Err(e) => get_error(format!("{}", e)), + } +} diff --git a/src/endpoints/quests/orbiter/verify_twitter_rt.rs b/src/endpoints/quests/orbiter/verify_twitter_rt.rs index 74583587..0131bab5 100644 --- a/src/endpoints/quests/orbiter/verify_twitter_rt.rs +++ b/src/endpoints/quests/orbiter/verify_twitter_rt.rs @@ -16,7 +16,7 @@ pub async fn handler( State(state): State>, Query(query): Query, ) -> impl IntoResponse { - let task_id = 35; + let task_id = 36; match state.upsert_completed_task(query.addr, task_id).await { Ok(_) => (StatusCode::OK, Json(json!({"res": true}))).into_response(), Err(e) => get_error(format!("{}", e)), diff --git a/src/main.rs b/src/main.rs index eff6f9aa..68b684aa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,6 +134,10 @@ async fn main() { "/quests/orbiter/verify_twitter_fw", get(endpoints::quests::orbiter::verify_twitter_fw::handler), ) + .route( + "/quests/orbiter/verify_twitter_fw_sq", + get(endpoints::quests::orbiter::verify_twitter_fw_sq::handler), + ) .route( "/quests/orbiter/verify_twitter_rt", get(endpoints::quests::orbiter::verify_twitter_rt::handler),