use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "filesystem_nodes")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
pub created_at: Option<DateTime<Utc>>,
pub updated_at: Option<DateTime<Utc>>,
pub name: String,
pub is_directory: bool,
#[sea_orm(column_type = "Text", nullable)]
pub file_path: Option<String>,
#[sea_orm(indexed)]
pub parent_id: Option<i64>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "Entity",
from = "Column::ParentId",
to = "Column::Id",
on_delete = "Cascade"
)]
Parent,
}
impl ActiveModelBehavior for ActiveModel {}
pub type VNode = Model;