diff --git a/src/data/follow/pg.rs b/src/data/follow/pg.rs index 42f8606..18ad85c 100644 --- a/src/data/follow/pg.rs +++ b/src/data/follow/pg.rs @@ -28,12 +28,13 @@ impl PgFollowDataSource { T: Into + Send, { let new = new.into(); - let follow: Follow = - sqlx::query_as("INSERT INTO follows (follower_id, followee_id) VALUES ($1, $2)") - .bind(new.follower_id) - .bind(new.followee_id) - .fetch_one(&self.pool) - .await?; + let follow: Follow = sqlx::query_as( + "INSERT INTO follows (follower_id, followee_id) VALUES ($1, $2) RETURNING *", + ) + .bind(new.follower_id) + .bind(new.followee_id) + .fetch_one(&self.pool) + .await?; Ok(follow) } diff --git a/src/data/like/pg.rs b/src/data/like/pg.rs index c38eb32..488f9ef 100644 --- a/src/data/like/pg.rs +++ b/src/data/like/pg.rs @@ -30,11 +30,12 @@ impl PgLikeDataSource { E: Into, { let new = new.try_into().map_err(|e| e.into())?.inner(); - let like: Like = sqlx::query_as("INSERT INTO likes (note_id, account_id) VALUES ($1, $2)") - .bind(new.note_id) - .bind(new.account_id) - .fetch_one(&self.pool) - .await?; + let like: Like = + sqlx::query_as("INSERT INTO likes (note_id, account_id) VALUES ($1, $2) RETURNING *") + .bind(new.note_id) + .bind(new.account_id) + .fetch_one(&self.pool) + .await?; Ok(like) }