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:
@@ -1,24 +0,0 @@
|
||||
use sea_orm::{ActiveModelTrait, ColumnTrait, DbConn, DbErr, EntityTrait, QueryFilter, Set};
|
||||
|
||||
use models::{domains::blog, params::blog::CreateBlogParams, queries::blog::BlogQuery};
|
||||
|
||||
pub async fn search_blogs(db: &DbConn, query: BlogQuery) -> Result<Vec<blog::Model>, DbErr> {
|
||||
blog::Entity::find()
|
||||
.filter(blog::Column::Title.contains(query.title.unwrap_or_default()))
|
||||
.all(db)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_blog(
|
||||
db: &DbConn,
|
||||
params: CreateBlogParams,
|
||||
) -> Result<blog::ActiveModel, DbErr> {
|
||||
blog::ActiveModel {
|
||||
author_id: Set(params.author_id as i32),
|
||||
title: Set(params.title),
|
||||
content: Set(params.content),
|
||||
..Default::default()
|
||||
}
|
||||
.save(db)
|
||||
.await
|
||||
}
|
@@ -1,2 +1 @@
|
||||
pub mod blog;
|
||||
pub mod user;
|
||||
|
Reference in New Issue
Block a user