feat: now returning discord and email
This commit is contained in:
parent
079a60cd0b
commit
cfd757507d
1 changed files with 12 additions and 2 deletions
|
@ -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,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue