spit into crates and fix app
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use sea_orm::Set;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "devices")]
|
||||
@@ -36,4 +37,12 @@ impl Related<super::sessions::Entity> for Entity {
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
impl ActiveModelBehavior for ActiveModel {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
uuid: Set(Uuid::new_v4()),
|
||||
device_id: Set(Uuid::new_v4().to_string()),
|
||||
..ActiveModelTrait::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
pub mod users;
|
||||
pub mod devices;
|
||||
pub mod sessions;
|
||||
pub mod sessions;
|
||||
pub mod prelude;
|
||||
|
6
neo-entity/src/prelude.rs
Normal file
6
neo-entity/src/prelude.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
#[allow(unused_imports)]
|
||||
pub use crate::{
|
||||
devices::{self, Entity as Device},
|
||||
sessions::{self, Entity as Session},
|
||||
users::{self, Entity as User},
|
||||
};
|
@@ -1,4 +1,5 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use sea_orm::Set;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "users")]
|
||||
@@ -13,7 +14,7 @@ pub struct Model {
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::devices::Entity")]
|
||||
Devices
|
||||
Devices,
|
||||
}
|
||||
|
||||
impl Related<super::devices::Entity> for Entity {
|
||||
@@ -22,4 +23,11 @@ impl Related<super::devices::Entity> for Entity {
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
impl ActiveModelBehavior for ActiveModel {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
uuid: Set(Uuid::new_v4()),
|
||||
..ActiveModelTrait::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user