use std::path::PathBuf; use chrono::NaiveDateTime; use serde::Serialize; use super::schema::{data, files}; use crate::util::hash::Hash; #[derive(Queryable, Serialize, Clone, Debug)] pub struct File { pub id: i32, pub hash: Hash, pub path: String, pub valid: bool, pub added: NaiveDateTime, pub size: i64, pub mtime: Option, } // todo - remove, try_from the actual model, impl queryable... #[derive(Serialize, Clone, Debug)] pub struct OutFile { pub id: i32, pub hash: Hash, pub path: PathBuf, pub valid: bool, pub added: NaiveDateTime, pub size: i64, pub mtime: Option, } #[derive(Insertable, Debug)] #[table_name = "files"] pub struct NewFile { pub hash: Vec, pub path: String, pub added: NaiveDateTime, pub size: i64, pub mtime: Option, } #[derive(Queryable, Insertable, Serialize, Debug)] #[table_name = "data"] pub struct Entry { pub identity: Vec, pub entity: Vec, pub attribute: String, pub value_str: Option, pub value_num: Option, pub immutable: bool, }