diff --git a/json-api/db/src/invites.rs b/json-api/db/src/invites.rs index bb01624..4e514b6 100644 --- a/json-api/db/src/invites.rs +++ b/json-api/db/src/invites.rs @@ -2,6 +2,8 @@ use mysql_async::{params, Pool, Conn}; use mysql_async::prelude::Queryable; use mysql_async::error::Error as SqlError; +use serde::Serialize; + use async_trait::async_trait; use crate::{UBigInt, BigInt}; @@ -9,6 +11,7 @@ use crate::common::FromDB; use crate::{Response, no_conn}; #[allow(dead_code)] +#[derive(Serialize)] pub struct Invite { pub id: BigInt, pub uses: Option, @@ -94,8 +97,8 @@ impl FromDB for Invite { let mapping_r = query.map_and_drop(|row| { let (id, uses): (BigInt, Option) = mysql_async::from_row(row); Invite { - id: id, - uses: uses, + id, + uses, expires: expirey_flag } }).await; @@ -120,8 +123,8 @@ impl Invite { Invite { id: (Utc::now() + chrono::Duration::minutes(30)).timestamp(), - uses: uses, - expires: expires + uses, + expires } } pub async fn add(&self, p: &Pool) -> Result<(), SqlError> { @@ -137,4 +140,4 @@ impl Invite { Ok(()) } -} \ No newline at end of file +}