2020-09-06 12:32:17 +02:00
|
|
|
use chrono::NaiveDateTime;
|
2020-08-27 01:29:44 +02:00
|
|
|
use serde::Serialize;
|
2020-08-27 00:11:50 +02:00
|
|
|
|
2020-09-07 21:21:54 +02:00
|
|
|
use super::schema::{data, files};
|
|
|
|
|
|
|
|
#[derive(Queryable, Serialize, Debug)]
|
2020-08-27 00:11:50 +02:00
|
|
|
pub struct File {
|
|
|
|
pub id: i32,
|
2020-09-12 14:27:45 +02:00
|
|
|
pub hash: Vec<u8>,
|
2020-08-27 00:11:50 +02:00
|
|
|
pub path: String,
|
|
|
|
pub size: i64,
|
2020-09-06 12:32:17 +02:00
|
|
|
pub created: NaiveDateTime,
|
2020-08-27 00:11:50 +02:00
|
|
|
pub valid: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, Debug)]
|
|
|
|
#[table_name = "files"]
|
|
|
|
pub struct NewFile {
|
2020-09-12 14:27:45 +02:00
|
|
|
pub hash: Vec<u8>,
|
2020-08-27 00:11:50 +02:00
|
|
|
pub path: String,
|
|
|
|
pub size: i64,
|
2020-09-06 12:32:17 +02:00
|
|
|
pub created: NaiveDateTime,
|
2020-08-27 00:11:50 +02:00
|
|
|
}
|
2020-09-07 21:21:54 +02:00
|
|
|
|
|
|
|
#[derive(Queryable, Insertable, Serialize, Debug)]
|
|
|
|
#[table_name = "data"]
|
|
|
|
pub struct Entry {
|
|
|
|
pub identity: Vec<u8>,
|
|
|
|
pub target: Vec<u8>,
|
|
|
|
pub key: String,
|
|
|
|
pub value: String,
|
|
|
|
}
|