48 lines
1.3 KiB
Rust
48 lines
1.3 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.1
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "node")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: i64,
|
|
#[sea_orm(column_type = "Double")]
|
|
pub coord_la: f64,
|
|
#[sea_orm(column_type = "Double")]
|
|
pub coord_lo: f64,
|
|
#[sea_orm(column_type = "Double")]
|
|
pub battery_minimum: f64,
|
|
#[sea_orm(column_type = "Double")]
|
|
pub battery_maximum: f64,
|
|
pub group: Uuid,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::node_group::Entity",
|
|
from = "Column::Group",
|
|
to = "super::node_group::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
NodeGroup,
|
|
#[sea_orm(has_many = "super::sensor_data::Entity")]
|
|
SensorData,
|
|
}
|
|
|
|
impl Related<super::node_group::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::NodeGroup.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::sensor_data::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::SensorData.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|