Update and Migrate Diesel to 2.0
Almost have tag support working, still figuring out how to get photo tags.
This commit is contained in:
@@ -16,12 +16,27 @@ pub struct Token<'a> {
|
||||
pub token: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Claims {
|
||||
pub sub: String,
|
||||
pub exp: i64,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod helper {
|
||||
use super::Claims;
|
||||
use chrono::{Duration, Utc};
|
||||
|
||||
impl Claims {
|
||||
pub fn valid_user(user_id: String) -> Self {
|
||||
Claims {
|
||||
sub: user_id,
|
||||
exp: (Utc::now() + Duration::minutes(1)).timestamp(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn secret_key() -> String {
|
||||
if cfg!(test) {
|
||||
String::from("test_key")
|
||||
|
||||
Reference in New Issue
Block a user