Skip to content

Commit

Permalink
Merge branch 'testnet' into pr/Nanle100/356
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchand-Nicolas committed Dec 17, 2024
2 parents fd02cd2 + 1728727 commit 306a190
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/endpoints/admin/quest/get_quest_users.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::middleware::auth::auth_middleware;
use crate::utils::verify_quest_auth;
use crate::utils::to_hex;
use crate::{
models::{AppState, CompletedTaskDocument, QuestDocument, QuestTaskDocument},
utils::get_error,
Expand All @@ -14,6 +15,7 @@ use futures::TryStreamExt;
use mongodb::bson::doc;
use serde::Deserialize;
use serde_json::json;
use starknet::core::types::FieldElement;
use std::collections::HashSet;
use std::sync::Arc;

Expand Down Expand Up @@ -79,7 +81,10 @@ pub async fn get_quest_users_handler(
.map(|task: CompletedTaskDocument| task.address().to_string())
.collect();

let users_list: Vec<String> = user_set.into_iter().collect();
let users_list: Vec<String> = user_set
.into_iter()
.filter_map(|addr| FieldElement::from_dec_str(&addr).ok().map(to_hex))
.collect();
users_list
}
Err(e) => return get_error(format!("Error processing completed tasks: {}", e)),
Expand Down
11 changes: 11 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,19 @@ pub_struct!(Debug, Serialize, Deserialize; QuestDocument {
expired: Option<bool>,
experience: i64,
start_time: i64,
banner: Option<Banner>
});

#[derive(Debug, Serialize, Deserialize)]
pub struct Banner {
tag: String,
title: String,
description: String,
cta: String,
href: String,
image: String,
}

pub_struct!(Debug, Serialize, Deserialize; QuestInsertDocument {
id: u32,
name: String,
Expand Down

0 comments on commit 306a190

Please sign in to comment.