feat: Refactor user and thought models to use UUIDs instead of integers

- Updated user and thought models to utilize UUIDs for primary keys.
- Modified persistence functions to accommodate UUIDs for user and thought IDs.
- Implemented tag functionality with new Tag and ThoughtTag models.
- Added migration scripts to create new tables for tags and thought-tag relationships.
- Enhanced thought creation to parse hashtags and link them to thoughts.
- Updated tests to reflect changes in user and thought ID types.
This commit is contained in:
2025-09-06 15:29:38 +02:00
parent c9e99e6f23
commit b83b7acf1c
38 changed files with 638 additions and 107 deletions

View File

@@ -64,9 +64,9 @@ async fn test_user_actor_endpoint() {
async fn test_user_inbox_follow() {
let app = setup().await;
// user1 will be followed
create_user_with_password(&app.db, "user1", "password123").await;
let user1 = create_user_with_password(&app.db, "user1", "password123").await;
// user2 will be the follower
create_user_with_password(&app.db, "user2", "password123").await;
let user2 = create_user_with_password(&app.db, "user2", "password123").await;
// Construct a follow activity from user2, targeting user1
let follow_activity = json!({
@@ -90,16 +90,19 @@ async fn test_user_inbox_follow() {
assert_eq!(response.status(), StatusCode::ACCEPTED);
// Verify that user2 is now following user1 in the database
let followers = app::persistence::follow::get_followed_ids(&app.db, 2)
.await
.unwrap();
assert!(followers.contains(&1), "User2 should be following user1");
let following = app::persistence::follow::get_followed_ids(&app.db, 1)
let followers = app::persistence::follow::get_followed_ids(&app.db, user2.id)
.await
.unwrap();
assert!(
!following.contains(&2),
followers.contains(&user1.id),
"User2 should be following user1"
);
let following = app::persistence::follow::get_followed_ids(&app.db, user1.id)
.await
.unwrap();
assert!(
!following.contains(&user2.id),
"User1 should now be followed by user2"
);
assert!(following.is_empty(), "User1 should not be following anyone");