32 lines
643 B
Rust
32 lines
643 B
Rust
use chrono::NaiveDateTime;
|
|
use serde::Serialize;
|
|
|
|
use super::schema::{data, files};
|
|
|
|
#[derive(Queryable, Serialize, Debug)]
|
|
pub struct File {
|
|
pub id: i32,
|
|
pub hash: Vec<u8>,
|
|
pub path: String,
|
|
pub size: i64,
|
|
pub created: NaiveDateTime,
|
|
pub valid: bool,
|
|
}
|
|
|
|
#[derive(Insertable, Debug)]
|
|
#[table_name = "files"]
|
|
pub struct NewFile {
|
|
pub hash: Vec<u8>,
|
|
pub path: String,
|
|
pub size: i64,
|
|
pub created: NaiveDateTime,
|
|
}
|
|
|
|
#[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,
|
|
}
|