Skip to content

Commit 1ebbdc9

Browse files
committed
feat: removed ChatKey from ChatData
1 parent 1350cbd commit 1ebbdc9

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

botsfwmodels/chat_base_data.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ var _ BotChatData = (*ChatBaseData)(nil)
1313
type ChatBaseData struct {
1414
changed bool // if true needs to be saved
1515

16-
ChatKey // BotID & ChatID
16+
//ChatKey // BotID & ChatID
1717

18-
// BotUserID is and ID of a bot user who owns this chat
19-
BotUserID string // We want it to be indexed and not to omit empty, so we can find chats without bot user assigned.
18+
// BotUserID is an ID of a bot user who owns this chat
19+
BotUserID string // We want it to be indexed and not to omitempty, to find chats without an assigned bot user.
2020

2121
// BotUserIDs keeps ids of bot users who are members of a group chat
2222
BotUserIDs []string `dalgo:",omitempty" datastore:",omitempty" firestore:",omitempty"`
@@ -27,7 +27,7 @@ type ChatBaseData struct {
2727

2828
// AppUserIntIDs is kept for legacy reasons
2929
// Deprecated: replace with `AppUserIDs []string`
30-
AppUserIntIDs []int64 `dalgo:",omitempty" datastore:",omitempty" firestore:",omitempty"`
30+
//AppUserIntIDs []int64 `dalgo:",omitempty" datastore:",omitempty" firestore:",omitempty"`
3131

3232
// IsGroup indicates if bot is added/used in a group chat
3333
IsGroup bool `dalgo:",noindex,omitempty" datastore:",noindex,omitempty" firestore:",omitempty"`
@@ -59,9 +59,9 @@ type ChatBaseData struct {
5959
}
6060

6161
func (e *ChatBaseData) Validate() error {
62-
if err := e.ChatKey.Validate(); err != nil {
63-
return err
64-
}
62+
//if err := e.ChatKey.Validate(); err != nil {
63+
// return err
64+
//}
6565
if strings.TrimSpace(e.BotUserID) == "" {
6666
return validation.NewErrBadRecordFieldValue("BotUserID", "is empty")
6767
}
@@ -78,19 +78,19 @@ func (e *ChatBaseData) Base() *ChatBaseData {
7878
return e
7979
}
8080

81-
// Indicates that chat data has been changed and record needs to be saved
81+
// IsChanged indicates that chat data has been changed and record needs to be saved
8282
func (e *ChatBaseData) IsChanged() bool {
8383
return e.changed || e.chatState.changed
8484
}
8585

86-
func (e *ChatBaseData) Key() ChatKey {
87-
return NewChatKey(e.BotID, e.ChatID)
88-
}
86+
//func (e *ChatBaseData) Key() ChatKey {
87+
// return NewChatKey(e.BotID, e.ChatID)
88+
//}
8989

9090
// GetBotID returns bot ID
91-
func (e *ChatBaseData) GetBotID() string {
92-
return e.BotID
93-
}
91+
//func (e *ChatBaseData) GetBotID() string {
92+
// return e.BotID
93+
//}
9494

9595
//// SetBotID sets bot ID - TODO: consider removing?
9696
//func (e *ChatBaseData) SetBotID(botID string) {
@@ -99,9 +99,9 @@ func (e *ChatBaseData) GetBotID() string {
9999
//}
100100

101101
// GetChatID returns chat ID
102-
func (e *ChatBaseData) GetChatID() string {
103-
return e.ChatID
104-
}
102+
//func (e *ChatBaseData) GetChatID() string {
103+
// return e.ChatID
104+
//}
105105

106106
//// SetChatID sets chat ID
107107
//func (e *ChatBaseData) SetChatID(chatID string) {

botsfwmodels/chat_data.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ type BotChatData interface {
1313
IsChanged() bool
1414

1515
// GetBotID returns bot ID
16-
GetBotID() (botID string)
16+
//GetBotID() (botID string)
1717

1818
//SetBotID(botID string)
1919

2020
// GetChatID returns chat ID
21-
GetChatID() (chatID string)
21+
//GetChatID() (chatID string)
2222
//SetChatID(chatID string)
2323

2424
// Key returns chat key
25-
Key() ChatKey
25+
//Key() ChatKey
2626

2727
// GetAppUserID returns app user ID
2828
GetAppUserID() (appUserID string)

0 commit comments

Comments
 (0)