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,22 +0,0 @@
|
||||
use sea_orm::{DatabaseConnection, Unchanged};
|
||||
|
||||
use app::persistence::blog::create_blog;
|
||||
use models::domains::blog;
|
||||
use models::params::blog::CreateBlogParams;
|
||||
|
||||
pub(super) async fn test_blog(db: &DatabaseConnection) {
|
||||
let params = CreateBlogParams {
|
||||
author_id: 1,
|
||||
title: "title".to_string(),
|
||||
content: "test".to_string(),
|
||||
};
|
||||
|
||||
let blog = create_blog(db, params).await.expect("Create blog failed!");
|
||||
let expected = blog::ActiveModel {
|
||||
id: Unchanged(1),
|
||||
author_id: Unchanged(1),
|
||||
title: Unchanged("title".to_owned()),
|
||||
content: Unchanged("test".to_owned()),
|
||||
};
|
||||
assert_eq!(blog, expected);
|
||||
}
|
@@ -1,9 +1,7 @@
|
||||
use utils::testing::setup_test_db;
|
||||
|
||||
mod blog;
|
||||
mod user;
|
||||
|
||||
use blog::test_blog;
|
||||
use user::test_user;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -14,13 +12,3 @@ async fn user_main() {
|
||||
|
||||
test_user(&db).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn blog_main() {
|
||||
let db = setup_test_db("sqlite::memory:")
|
||||
.await
|
||||
.expect("Set up db failed!");
|
||||
|
||||
test_user(&db).await;
|
||||
test_blog(&db).await;
|
||||
}
|
||||
|
Reference in New Issue
Block a user