From cfd757507d423a0be40ba16744b992a0fb0a9380 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Mon, 11 Sep 2023 00:55:23 +0100 Subject: [PATCH] feat: now returning discord and email --- src/methods/discord.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/methods/discord.rs b/src/methods/discord.rs index a8f7648..1c32e78 100644 --- a/src/methods/discord.rs +++ b/src/methods/discord.rs @@ -7,6 +7,7 @@ use tide::{ pub mod account { use super::*; + use serde::Serialize; #[derive(Debug, Deserialize)] struct Auth { @@ -30,7 +31,13 @@ pub mod account { Ok(json!(result).into()) } - pub async fn get_wolves_mail(db: &Pool) -> Vec { + #[derive(Debug, Deserialize, Serialize)] + pub struct DiscordResult { + discord: String, + email: String, + } + + pub async fn get_wolves_mail(db: &Pool) -> Vec { let results = sqlx::query_as::<_, Accounts>( r#" SELECT * @@ -46,7 +53,10 @@ pub mod account { for item in results { if let Some(discord) = item.discord { - result.push(discord); + result.push(DiscordResult { + discord, + email: item.mail, + }); } }