mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 05:31:11 +02:00
56 lines
1.4 KiB
Rust
56 lines
1.4 KiB
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, serde::Serialize, serde::Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[sea_orm(table_name = "channel_note_pining")]
|
|
#[cfg_attr(
|
|
feature = "napi",
|
|
napi_derive::napi(object, js_name = "ChannelNotePining", use_nullable = true)
|
|
)]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: String,
|
|
#[sea_orm(column_name = "createdAt")]
|
|
pub created_at: DateTime,
|
|
#[sea_orm(column_name = "channelId")]
|
|
pub channel_id: String,
|
|
#[sea_orm(column_name = "noteId")]
|
|
pub note_id: String,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::channel::Entity",
|
|
from = "Column::ChannelId",
|
|
to = "super::channel::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Channel,
|
|
#[sea_orm(
|
|
belongs_to = "super::note::Entity",
|
|
from = "Column::NoteId",
|
|
to = "super::note::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Note,
|
|
}
|
|
|
|
impl Related<super::channel::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Channel.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::note::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Note.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|