54 lines
1.4 KiB
Rust
54 lines
1.4 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[sea_orm(table_name = "user_list")]
|
|
#[macros::export(object, js_name = "UserList")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: String,
|
|
#[sea_orm(column_name = "createdAt")]
|
|
pub created_at: DateTimeWithTimeZone,
|
|
#[sea_orm(column_name = "userId")]
|
|
pub user_id: String,
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::antenna::Entity")]
|
|
Antenna,
|
|
#[sea_orm(
|
|
belongs_to = "super::user::Entity",
|
|
from = "Column::UserId",
|
|
to = "super::user::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "Cascade"
|
|
)]
|
|
User,
|
|
#[sea_orm(has_many = "super::user_list_joining::Entity")]
|
|
UserListJoining,
|
|
}
|
|
|
|
impl Related<super::antenna::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Antenna.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::user::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::User.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::user_list_joining::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::UserListJoining.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|