summaryrefslogtreecommitdiff
path: root/src/message/repo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/message/repo.rs')
-rw-r--r--src/message/repo.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/message/repo.rs b/src/message/repo.rs
index 4cfefec..c8ceceb 100644
--- a/src/message/repo.rs
+++ b/src/message/repo.rs
@@ -79,8 +79,8 @@ impl<'c> Messages<'c> {
message.body as "body: Body",
message.sent_at as "sent_at: DateTime",
message.sent_sequence as "sent_sequence: Sequence",
- deleted.deleted_at as "deleted_at: DateTime",
- deleted.deleted_sequence as "deleted_sequence: Sequence"
+ deleted.deleted_at as "deleted_at?: DateTime",
+ deleted.deleted_sequence as "deleted_sequence?: Sequence"
from message
left join message_deleted as deleted
using (id)
@@ -186,33 +186,31 @@ impl<'c> Messages<'c> {
) -> Result<History, sqlx::Error> {
let id = message.id();
- sqlx::query_scalar!(
+ sqlx::query!(
r#"
insert into message_deleted (id, deleted_at, deleted_sequence)
values ($1, $2, $3)
- returning 1 as "deleted: bool"
"#,
id,
deleted.at,
deleted.sequence,
)
- .fetch_one(&mut *self.0)
+ .execute(&mut *self.0)
.await?;
// Small social responsibility hack here: when a message is deleted, its body is
// retconned to have been the empty string. Someone reading the event stream
// afterwards, or looking at messages in the channel, cannot retrieve the
// "deleted" message by ignoring the deletion event.
- sqlx::query_scalar!(
+ sqlx::query!(
r#"
update message
- set body = ""
+ set body = ''
where id = $1
- returning 1 as "blanked: bool"
"#,
id,
)
- .fetch_one(&mut *self.0)
+ .execute(&mut *self.0)
.await?;
let message = self.by_id(id).await?;