can store and retrive data now lol ok xd

This commit is contained in:
2026-03-27 17:59:06 +00:00
parent 7ae73dc49e
commit 957cdf22cb
9 changed files with 242 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "channel")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub id_discord: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::messages::Entity")]
Messages,
}
impl Related<super::messages::Entity> for Entity {
fn to() -> RelationDef {
Relation::Messages.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
+1
View File
@@ -2,6 +2,7 @@
pub mod prelude;
pub mod channel;
pub mod content;
pub mod members;
pub mod messages;
+15
View File
@@ -10,11 +10,20 @@ pub struct Model {
pub id_discord: i32,
pub id_sender: i32,
pub id_content: i32,
pub id_channel: i32,
pub id_server: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::channel::Entity",
from = "Column::IdChannel",
to = "super::channel::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
Channel,
#[sea_orm(
belongs_to = "super::content::Entity",
from = "Column::IdContent",
@@ -25,6 +34,12 @@ pub enum Relation {
Content,
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl Related<super::content::Entity> for Entity {
fn to() -> RelationDef {
Relation::Content.def()
+1
View File
@@ -1,5 +1,6 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
pub use super::channel::Entity as Channel;
pub use super::content::Entity as Content;
pub use super::members::Entity as Members;
pub use super::messages::Entity as Messages;