fix new all command
This commit is contained in:
@@ -10,6 +10,10 @@ import (
|
||||
)
|
||||
|
||||
type chatDTO struct {
|
||||
ChatID int64 `bson:"chat_id"`
|
||||
}
|
||||
|
||||
type chatInfoDTO struct {
|
||||
ChatID int64 `bson:"chat_id"`
|
||||
Users []string `bson:"users"`
|
||||
}
|
||||
@@ -77,9 +81,9 @@ func GetUsers(chatID int64) ([]string, error) {
|
||||
}
|
||||
|
||||
collection := client.Database(cfg.DBName).Collection(cfg.ChatsCollectionName)
|
||||
chatDTO := &chatDTO{}
|
||||
if err := collection.FindOne(ctx, bson.M{"chat_id": chatID}).Decode(chatDTO); err != nil {
|
||||
chatInfoDTO := &chatInfoDTO{}
|
||||
if err := collection.FindOne(ctx, bson.M{"chat_id": chatID}).Decode(chatInfoDTO); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return chatDTO.Users, err
|
||||
return chatInfoDTO.Users, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user