diff --git a/src/graphql.rs b/src/graphql.rs index 8675012..a1c54e5 100644 --- a/src/graphql.rs +++ b/src/graphql.rs @@ -619,11 +619,11 @@ impl Query { let mut messages = Vec::new(); for message in sqlx::query(format!( - r#"SELECT * FROM msgdata_{} SORT BY timestamp DESCENDING"#, + r#"SELECT * FROM msgdata_{} ORDER BY timestamp DESC"#, chat, ).as_str()).fetch_all(&context.db).await? { messages.push(Message { - id: ID::from(message.try_get::("id")?), + id: ID::from(message.try_get::("msg_id")?), timestamp: message.try_get::("timestamp")?.try_into()?, sender: message.try_get::("sender_id")?.into(), msg_type: message.try_get::("msg_type")?.try_into()?,