Initial commit
This commit is contained in:
31
backend/entity/file.rs
Normal file
31
backend/entity/file.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "file")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false, column_type = "Binary(16)")]
|
||||
pub id: Vec<u8>,
|
||||
#[sea_orm(unique)]
|
||||
pub hash: String,
|
||||
pub uploader_ip: String,
|
||||
pub uploaded_at: DateTime,
|
||||
pub download_until: DateTime,
|
||||
#[sea_orm(column_type = "Binary(255)")]
|
||||
pub encrypted_metadata: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::access_log::Entity")]
|
||||
AccessLog,
|
||||
}
|
||||
|
||||
impl Related<super::access_log::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::AccessLog.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in New Issue
Block a user