feat: implement user follow/unfollow functionality and thought retrieval by user

- Added follow and unfollow endpoints for users.
- Implemented logic to retrieve thoughts by a specific user.
- Updated user error handling to include cases for already following and not following.
- Created persistence layer for follow relationships.
- Enhanced user and thought schemas to support new features.
- Added tests for follow/unfollow endpoints and thought retrieval.
- Updated frontend to display thoughts and allow posting new thoughts.
This commit is contained in:
2025-09-05 19:08:37 +02:00
parent 912259ef54
commit decf81e535
31 changed files with 872 additions and 155 deletions

View File

@@ -1,30 +1,5 @@
use api::setup_router;
use utils::testing::setup_test_db;
mod root;
mod feed;
mod follow;
mod main;
mod thought;
mod user;
use root::*;
use user::*;
#[tokio::test]
async fn root_main() {
let db = setup_test_db("sqlite::root?mode=memory&cache=shared")
.await
.expect("Set up db failed!");
let app = setup_router(db);
test_root(app).await;
}
#[tokio::test]
async fn user_main() {
let db = setup_test_db("sqlite::user?mode=memory&cache=shared")
.await
.expect("Set up db failed!");
let app = setup_router(db);
test_post_users(app.clone()).await;
test_post_users_error(app.clone()).await;
test_get_users(app).await;
}