Refactor blog module and remove blog-related functionality
- Removed blog router and associated API endpoints. - Deleted blog persistence functions and related query parameters. - Removed blog schemas and models from the codebase. - Introduced common crate for shared types, including DateTimeWithTimeZoneWrapper. - Added Thought and Follow models with corresponding migrations. - Updated dependencies in Cargo.toml files to reflect changes. - Adjusted tests to remove references to the blog module.
This commit is contained in:
32
thoughts-backend/models/src/domains/follow.rs
Normal file
32
thoughts-backend/models/src/domains/follow.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "follow")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub follower_id: i32,
|
||||
#[sea_orm(primary_key)]
|
||||
pub followed_id: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::FollowerId",
|
||||
to = "super::user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Follower,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::FollowedId",
|
||||
to = "super::user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Followed,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
@@ -2,5 +2,6 @@
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod blog;
|
||||
pub mod follow;
|
||||
pub mod thought;
|
||||
pub mod user;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
|
||||
|
||||
pub use super::blog::Entity as Blog;
|
||||
pub use super::follow::Entity as Follow;
|
||||
pub use super::thought::Entity as Thought;
|
||||
pub use super::user::Entity as User;
|
||||
|
@@ -1,15 +1,13 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "blog")]
|
||||
#[sea_orm(table_name = "thought")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub author_id: i32,
|
||||
pub title: String,
|
||||
pub content: String,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
@@ -12,15 +12,6 @@ pub struct Model {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::blog::Entity")]
|
||||
Blog,
|
||||
}
|
||||
|
||||
impl Related<super::blog::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Blog.def()
|
||||
}
|
||||
}
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
Reference in New Issue
Block a user