Skip to content

Commit

Permalink
created_at
Browse files Browse the repository at this point in the history
  • Loading branch information
ddboline committed Nov 24, 2024
1 parent 6baf512 commit a494f71
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/logged_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rweb::{
filters::{cookie::cookie, BoxedFilter},
Filter, FromRequest, Rejection, Schema,
};
use rweb_helper::UuidWrapper;
use rweb_helper::{UuidWrapper, DateTimeType};
use serde::{Deserialize, Serialize};
use stack_string::StackString;
use std::{
Expand All @@ -32,6 +32,8 @@ pub struct LoggedUser {
pub session: UuidWrapper,
#[schema(description = "Secret Key")]
pub secret_key: StackString,
#[schema(description = "User Created At")]
pub created_at: DateTimeType,
}

impl LoggedUser {
Expand Down Expand Up @@ -71,6 +73,7 @@ impl From<ExternalUser> for LoggedUser {
email: user.email,
session: user.session.into(),
secret_key: user.secret_key,
created_at: user.created_at.into(),
}
}
}
Expand Down Expand Up @@ -107,7 +110,7 @@ pub async fn fill_from_db(pool: &PgPool) -> Result<(), Error> {
email: "user@test".into(),
session: Uuid::new_v4(),
secret_key: StackString::default(),
created_at: Some(OffsetDateTime::now_utc())
created_at: OffsetDateTime::now_utc()
}
});
return Ok(());
Expand All @@ -133,7 +136,7 @@ pub async fn fill_from_db(pool: &PgPool) -> Result<(), Error> {
email: u.email,
session: Uuid::new_v4(),
secret_key: StackString::default(),
created_at: Some(u.created_at),
created_at: u.created_at,
},
)
})
Expand Down

0 comments on commit a494f71

Please sign in to comment.