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:
Cameron Cordes
2023-03-18 14:43:41 -04:00
parent 40c79d13db
commit 68bfcbf85f
8 changed files with 1009 additions and 586 deletions

View File

@@ -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")