You've already forked AstralRinth
forked from didirus/AstralRinth
Initial Auth Impl + More Caching (#647)
* Port redis to staging * redis cache on staging * add back legacy auth callback * Begin work on new auth flows * Finish all auth flows * Finish base session authentication * run prep + fix clippy * make compilation work
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use super::ids::Base62Id;
|
||||
use crate::models::ids::{ThreadId, UserId};
|
||||
use crate::database::models::report_item::QueryReport as DBReport;
|
||||
use crate::models::ids::{ProjectId, ThreadId, UserId, VersionId};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -40,3 +41,33 @@ impl ItemType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DBReport> for Report {
|
||||
fn from(x: DBReport) -> Self {
|
||||
let mut item_id = "".to_string();
|
||||
let mut item_type = ItemType::Unknown;
|
||||
|
||||
if let Some(project_id) = x.project_id {
|
||||
item_id = ProjectId::from(project_id).to_string();
|
||||
item_type = ItemType::Project;
|
||||
} else if let Some(version_id) = x.version_id {
|
||||
item_id = VersionId::from(version_id).to_string();
|
||||
item_type = ItemType::Version;
|
||||
} else if let Some(user_id) = x.user_id {
|
||||
item_id = UserId::from(user_id).to_string();
|
||||
item_type = ItemType::User;
|
||||
}
|
||||
|
||||
Report {
|
||||
id: x.id.into(),
|
||||
report_type: x.report_type,
|
||||
item_id,
|
||||
item_type,
|
||||
reporter: x.reporter.into(),
|
||||
body: x.body,
|
||||
created: x.created,
|
||||
closed: x.closed,
|
||||
thread_id: x.thread_id.map(|x| x.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user