upend/src/models.rs

33 lines
643 B
Rust
Raw Normal View History

2020-09-06 12:32:17 +02:00
use chrono::NaiveDateTime;
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,
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 {
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,
}