refactor: update channel pagination and reconnect
This commit is contained in:
parent
22192301a0
commit
4d2e4d8b36
@ -65,7 +65,7 @@ impl MessagePagination {
|
||||
db::sqlx::query_as::<_, model::room::RoomMessageModel>(
|
||||
db::sqlx::AssertSqlSafe(format!(
|
||||
"SELECT {RM_COLUMNS} FROM room_message \
|
||||
WHERE room = $1 AND seq < $2 AND deleted_at IS NULL \
|
||||
WHERE room = $1 AND seq < $2 AND deleted_at IS NULL AND thread IS NULL \
|
||||
ORDER BY seq DESC LIMIT $3"
|
||||
)),
|
||||
)
|
||||
@ -79,7 +79,7 @@ impl MessagePagination {
|
||||
db::sqlx::query_as::<_, model::room::RoomMessageModel>(
|
||||
db::sqlx::AssertSqlSafe(format!(
|
||||
"SELECT {RM_COLUMNS} FROM room_message \
|
||||
WHERE room = $1 AND seq > $2 AND deleted_at IS NULL \
|
||||
WHERE room = $1 AND seq > $2 AND deleted_at IS NULL AND thread IS NULL \
|
||||
ORDER BY seq ASC LIMIT $3"
|
||||
)),
|
||||
)
|
||||
@ -93,7 +93,7 @@ impl MessagePagination {
|
||||
db::sqlx::query_as::<_, model::room::RoomMessageModel>(
|
||||
db::sqlx::AssertSqlSafe(format!(
|
||||
"SELECT {RM_COLUMNS} FROM room_message \
|
||||
WHERE room = $1 AND deleted_at IS NULL \
|
||||
WHERE room = $1 AND deleted_at IS NULL AND thread IS NULL \
|
||||
ORDER BY seq DESC LIMIT $2"
|
||||
)),
|
||||
)
|
||||
|
||||
@ -22,6 +22,12 @@ pub struct MissedMessage {
|
||||
pub content: String,
|
||||
pub sender_id: Uuid,
|
||||
pub send_at: chrono::DateTime<chrono::Utc>,
|
||||
pub thread: Option<Uuid>,
|
||||
pub parent: Option<Uuid>,
|
||||
pub content_type: String,
|
||||
pub pinned: bool,
|
||||
pub system_type: Option<String>,
|
||||
pub metadata: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -69,7 +75,7 @@ impl ReconnectManager {
|
||||
let messages = db::sqlx::query_as::<_, RoomMessageModel>(
|
||||
db::sqlx::AssertSqlSafe(format!(
|
||||
"SELECT {RM_COLUMNS} FROM room_message \
|
||||
WHERE room = $1 AND seq > $2 AND deleted_at IS NULL \
|
||||
WHERE room = $1 AND seq > $2 AND deleted_at IS NULL AND thread IS NULL \
|
||||
ORDER BY seq ASC \
|
||||
LIMIT 100"
|
||||
)),
|
||||
@ -88,6 +94,12 @@ impl ReconnectManager {
|
||||
content: m.content,
|
||||
sender_id: m.author,
|
||||
send_at: m.created_at,
|
||||
thread: m.thread,
|
||||
parent: m.parent,
|
||||
content_type: m.content_type,
|
||||
pinned: m.pinned,
|
||||
system_type: m.system_type,
|
||||
metadata: m.metadata,
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user