From 60fe9bf40687dccec7d6d26d9cf08b9b338d592d Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Fri, 23 Sep 2022 21:03:58 +0000 Subject: [PATCH] Use Pubkey as the index key to uniquely identify a user in Message table. --- indexedDb/model.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/indexedDb/model.go b/indexedDb/model.go index 6b26e908..197d26e7 100644 --- a/indexedDb/model.go +++ b/indexedDb/model.go @@ -24,7 +24,7 @@ const ( // Message index names. messageStoreChannelIndex = "channel_id_index" - messageStoreUserIndex = "user_id_index" + messageStoreUserIndex = "user_pubkey_index" messageStoreParentIndex = "parent_message_id_index" messageStoreTimestampIndex = "timestamp_index" messageStorePinnedIndex = "pinned_index" @@ -34,7 +34,7 @@ const ( // Message keyPath names (must match json struct tags). messageStoreChannel = "channel_id" - messageStoreUser = "user_id" + messageStoreUser = "user_pubkey" messageStoreParent = "parent_message_id" messageStoreTimestamp = "timestamp" messageStorePinned = "pinned" @@ -52,7 +52,7 @@ type Message struct { Id []byte `json:"id"` // Matches pkeyName Nickname string `json:"nickname"` ChannelId []byte `json:"channel_id"` // Index - UserId []byte `json:"user_id"` // Index + UserPubkey []byte `json:"user_pubkey"` // Index ParentMessageId []byte `json:"parent_message_id"` // Index Timestamp time.Time `json:"timestamp"` // Index Lease time.Duration `json:"lease"` @@ -76,8 +76,7 @@ type Channel struct { // // A User has many Message. type User struct { - Id []byte `json:"id"` // Matches pkeyName - Pubkey []byte `json:"pubkey"` //Index + Pubkey []byte `json:"pubkey"` // Matches pkeyName Honorific string `json:"honorific"` Adjective string `json:"adjective"` Noun string `json:"noun"` -- GitLab