added profile pictures to messages and improved chat page layout
This commit is contained in:
@@ -17,15 +17,17 @@ use crate::{
|
||||
pub struct MessageRow {
|
||||
pub uuid: Uuid,
|
||||
pub sender: String,
|
||||
pub sender_uuid: Uuid,
|
||||
pub message_type: String,
|
||||
pub content: String,
|
||||
pub sent_at: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(sqlx::FromRow, serde::Serialize, Debug, Clone)]
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
pub struct Message {
|
||||
pub uuid: Uuid,
|
||||
pub sender: String,
|
||||
pub sender_uuid: Uuid,
|
||||
pub message_type: String,
|
||||
pub content: String,
|
||||
pub sent_at: String,
|
||||
@@ -74,6 +76,7 @@ async fn list_messages(
|
||||
SELECT
|
||||
m.uuid,
|
||||
u.username AS sender,
|
||||
u.uuid AS sender_uuid,
|
||||
r.uuid AS room,
|
||||
m.message_type,
|
||||
m.content,
|
||||
@@ -104,6 +107,7 @@ async fn list_messages(
|
||||
.map(|m| Message {
|
||||
uuid: m.uuid,
|
||||
sender: m.sender,
|
||||
sender_uuid: m.sender_uuid,
|
||||
message_type: m.message_type,
|
||||
content: m.content,
|
||||
sent_at: m.sent_at.format("%Y-%m-%d %H:%M:%S").to_string(),
|
||||
@@ -154,6 +158,7 @@ async fn create_message(
|
||||
let message = Message {
|
||||
uuid: uuid,
|
||||
sender: sender_name,
|
||||
sender_uuid: claims.sub,
|
||||
message_type: payload.message_type,
|
||||
content: payload.content,
|
||||
sent_at: sent_at.format("%Y-%m-%d %H:%M:%S").to_string(),
|
||||
|
||||
Reference in New Issue
Block a user