summaryrefslogtreecommitdiff
path: root/src/channel/repo
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-09-13 01:26:56 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-09-13 02:42:27 -0400
commit3193a30ebcf6bafdeaf463eda0e7e82082dfe4b5 (patch)
tree2fb3ea84923aecf0ec1f820408bdc670b1247c95 /src/channel/repo
parent067e3da1900d052a416c56e1c047640aa23441ae (diff)
Embed the sender's whole login (id and name) in messages, drop the redundant channel ID.
Diffstat (limited to 'src/channel/repo')
-rw-r--r--src/channel/repo/messages.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/channel/repo/messages.rs b/src/channel/repo/messages.rs
index bdb0d29..0d74ea9 100644
--- a/src/channel/repo/messages.rs
+++ b/src/channel/repo/messages.rs
@@ -19,11 +19,13 @@ impl<'c> Provider for Transaction<'c, Sqlite> {
pub struct Messages<'t>(&'t mut SqliteConnection);
-#[derive(Clone, Debug, serde::Serialize)]
+#[derive(Clone, Debug)]
pub struct Message {
pub id: Id,
pub sender: LoginId,
- pub channel: ChannelId,
+ // Field not actually used at this time, but you can reinstate it if you
+ // need to. It's not omitted out of any greater design intention.
+ // pub channel: ChannelId,
pub body: String,
pub sent_at: DateTime,
}
@@ -47,7 +49,7 @@ impl<'c> Messages<'c> {
returning
id as "id: Id",
sender as "sender: LoginId",
- channel as "channel: ChannelId",
+ -- channel as "channel: ChannelId",
body,
sent_at as "sent_at: DateTime"
"#,
@@ -70,7 +72,7 @@ impl<'c> Messages<'c> {
select
id as "id: Id",
sender as "sender: LoginId",
- channel as "channel: ChannelId",
+ -- channel as "channel: ChannelId",
body,
sent_at as "sent_at: DateTime"
from message