Initial version of pools
This commit is contained in:
parent
fe7edb93ad
commit
2b6b1f30f4
21 changed files with 577 additions and 36 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod samey_config;
|
||||
pub mod samey_pool;
|
||||
pub mod samey_pool_post;
|
||||
pub mod samey_post;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
|
||||
|
||||
pub use super::samey_config::Entity as SameyConfig;
|
||||
pub use super::samey_pool::Entity as SameyPool;
|
||||
pub use super::samey_pool_post::Entity as SameyPoolPost;
|
||||
pub use super::samey_post::Entity as SameyPost;
|
||||
|
|
|
|||
18
src/entities/samey_config.rs
Normal file
18
src/entities/samey_config.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.8
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "samey_config")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
#[sea_orm(unique)]
|
||||
pub key: String,
|
||||
pub data: Json,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
@ -9,12 +9,22 @@ pub struct Model {
|
|||
pub id: i32,
|
||||
#[sea_orm(unique)]
|
||||
pub name: String,
|
||||
pub uploader_id: i32,
|
||||
pub is_public: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::samey_pool_post::Entity")]
|
||||
SameyPoolPost,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::samey_user::Entity",
|
||||
from = "Column::UploaderId",
|
||||
to = "super::samey_user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
SameyUser,
|
||||
}
|
||||
|
||||
impl Related<super::samey_pool_post::Entity> for Entity {
|
||||
|
|
@ -23,4 +33,10 @@ impl Related<super::samey_pool_post::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::samey_user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::SameyUser.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,18 @@ pub struct Model {
|
|||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::samey_pool::Entity")]
|
||||
SameyPool,
|
||||
#[sea_orm(has_many = "super::samey_post::Entity")]
|
||||
SameyPost,
|
||||
}
|
||||
|
||||
impl Related<super::samey_pool::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::SameyPool.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::samey_post::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::SameyPost.def()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue