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:
@@ -10,7 +10,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
migration = { path = "../migration" }
|
||||
uuid = { version = "1.18.1", features = ["v4"] }
|
||||
uuid = { version = "1.18.1", features = ["v4", "serde"] }
|
||||
sea-orm = { version = "1.1.12", features = ["sqlx-sqlite", "sqlx-postgres"] }
|
||||
|
||||
axum = { workspace = true }
|
||||
|
@@ -5,8 +5,9 @@ use axum::{
|
||||
Router,
|
||||
};
|
||||
use tower::ServiceExt;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub async fn make_get_request(app: Router, url: &str, user_id: Option<i32>) -> Response {
|
||||
pub async fn make_get_request(app: Router, url: &str, user_id: Option<Uuid>) -> Response {
|
||||
let mut builder = Request::builder()
|
||||
.uri(url)
|
||||
.header("Content-Type", "application/json");
|
||||
@@ -24,7 +25,7 @@ pub async fn make_post_request(
|
||||
app: Router,
|
||||
url: &str,
|
||||
body: String,
|
||||
user_id: Option<i32>,
|
||||
user_id: Option<Uuid>,
|
||||
) -> Response {
|
||||
let mut builder = Request::builder()
|
||||
.method("POST")
|
||||
@@ -40,7 +41,7 @@ pub async fn make_post_request(
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub async fn make_delete_request(app: Router, url: &str, user_id: Option<i32>) -> Response {
|
||||
pub async fn make_delete_request(app: Router, url: &str, user_id: Option<Uuid>) -> Response {
|
||||
let mut builder = Request::builder()
|
||||
.method("DELETE")
|
||||
.uri(url)
|
||||
|
Reference in New Issue
Block a user