34 lines
843 B
Rust
34 lines
843 B
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.5
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "notes")]
|
|
pub struct Model {
|
|
pub created_at: DateTime,
|
|
pub updated_at: DateTime,
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub title: Option<String>,
|
|
pub content: Option<String>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::files::Entity")]
|
|
Files,
|
|
}
|
|
|
|
impl Related<super::files::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Files.def()
|
|
}
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
|
|
pub enum RelatedEntity {
|
|
#[sea_orm(entity = "super::files::Entity")]
|
|
Files,
|
|
}
|