feat: add reply functionality to thoughts, including database migration and tests
This commit is contained in:
@@ -12,6 +12,7 @@ pub struct ThoughtSchema {
|
||||
pub author_username: String,
|
||||
#[schema(example = "This is my first thought! #welcome")]
|
||||
pub content: String,
|
||||
pub reply_to_id: Option<Uuid>,
|
||||
pub created_at: DateTimeWithTimeZoneWrapper,
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ impl ThoughtSchema {
|
||||
id: thought.id,
|
||||
author_username: author.username.clone(),
|
||||
content: thought.content.clone(),
|
||||
reply_to_id: thought.reply_to_id,
|
||||
created_at: thought.created_at.into(),
|
||||
}
|
||||
}
|
||||
@@ -44,6 +46,7 @@ pub struct ThoughtWithAuthor {
|
||||
pub created_at: sea_orm::prelude::DateTimeWithTimeZone,
|
||||
pub author_id: Uuid,
|
||||
pub author_username: String,
|
||||
pub reply_to_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
impl From<ThoughtWithAuthor> for ThoughtSchema {
|
||||
@@ -53,6 +56,7 @@ impl From<ThoughtWithAuthor> for ThoughtSchema {
|
||||
author_username: model.author_username,
|
||||
content: model.content,
|
||||
created_at: model.created_at.into(),
|
||||
reply_to_id: model.reply_to_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user