feat: now returning discord and email

This commit is contained in:
silver 2023-09-11 00:55:23 +01:00
parent 079a60cd0b
commit cfd757507d

View file

@ -7,6 +7,7 @@ use tide::{
pub mod account { pub mod account {
use super::*; use super::*;
use serde::Serialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct Auth { struct Auth {
@ -30,7 +31,13 @@ pub mod account {
Ok(json!(result).into()) Ok(json!(result).into())
} }
pub async fn get_wolves_mail(db: &Pool<Sqlite>) -> Vec<String> { #[derive(Debug, Deserialize, Serialize)]
pub struct DiscordResult {
discord: String,
email: String,
}
pub async fn get_wolves_mail(db: &Pool<Sqlite>) -> Vec<DiscordResult> {
let results = sqlx::query_as::<_, Accounts>( let results = sqlx::query_as::<_, Accounts>(
r#" r#"
SELECT * SELECT *
@ -46,7 +53,10 @@ pub mod account {
for item in results { for item in results {
if let Some(discord) = item.discord { if let Some(discord) = item.discord {
result.push(discord); result.push(DiscordResult {
discord,
email: item.mail,
});
} }
} }