* Reports WIP

* Finish reports

* Clippy fixes

Co-authored-by: Geometrically <geometrically@pop-os.localdomain>
This commit is contained in:
Geometrically
2021-02-13 12:11:13 -07:00
committed by GitHub
parent 3df740702c
commit 109d7d87bd
21 changed files with 1158 additions and 238 deletions

View File

@@ -86,6 +86,13 @@ generate_ids!(
"SELECT EXISTS(SELECT 1 FROM users WHERE id=$1)",
UserId
);
generate_ids!(
pub generate_report_id,
ReportId,
8,
"SELECT EXISTS(SELECT 1 FROM reports WHERE id=$1)",
ReportId
);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Type)]
#[sqlx(transparent)]
@@ -130,6 +137,13 @@ pub struct LoaderId(pub i32);
#[sqlx(transparent)]
pub struct CategoryId(pub i32);
#[derive(Copy, Clone, Debug, Type)]
#[sqlx(transparent)]
pub struct ReportId(pub i64);
#[derive(Copy, Clone, Debug, Type)]
#[sqlx(transparent)]
pub struct ReportTypeId(pub i32);
#[derive(Copy, Clone, Debug, Type)]
#[sqlx(transparent)]
pub struct FileId(pub i64);
@@ -180,3 +194,13 @@ impl From<VersionId> for ids::VersionId {
ids::VersionId(id.0 as u64)
}
}
impl From<ids::ReportId> for ReportId {
fn from(id: ids::ReportId) -> Self {
ReportId(id.0 as i64)
}
}
impl From<ReportId> for ids::ReportId {
fn from(id: ReportId) -> Self {
ids::ReportId(id.0 as u64)
}
}