-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d85cfe
commit 1dbc328
Showing
20 changed files
with
545 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ws | ||
|
||
import ( | ||
"context" | ||
"github.com/redis/go-redis/v9" | ||
"go-live-chat/internal/model" | ||
) | ||
|
||
type ConversationUseCase interface { | ||
FindMembers(input interface{}, ctx context.Context) ([]model.Member, *model.Error) | ||
StoreMessage(messages []model.Message, ctx context.Context) *model.Error | ||
PublishMessage(messages []model.Message, ctx context.Context) *model.Error | ||
PrepareMessage( | ||
members []model.Member, | ||
message string, | ||
from string) []model.Message | ||
} | ||
|
||
type RetrieveChatroomUseCase interface { | ||
ExecuteById(id string, ctx context.Context) (*model.Chatroom, *model.Error) | ||
} | ||
|
||
type RedisClient interface { | ||
Publish(ctx context.Context, channel string, message interface{}) *redis.IntCmd | ||
Subscribe(ctx context.Context, channels ...string) *redis.PubSub | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package model | ||
|
||
import "go.mongodb.org/mongo-driver/bson/primitive" | ||
|
||
type Message struct { | ||
Id primitive.ObjectID `json:"id" bson:"_id"` | ||
From string `json:"from" bson:"from"` | ||
To string `json:"to" bson:"to"` | ||
Content string `json:"content" bson:"content"` | ||
Type string `json:"type" bson:"type"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package repositories | ||
|
||
import ( | ||
"go-live-chat/internal/configs" | ||
"go-live-chat/internal/infraestructure/databases" | ||
"go-live-chat/internal/model" | ||
) | ||
|
||
type ConversationsRepository struct { | ||
client MongoClientInterface | ||
config *configs.Config | ||
} | ||
|
||
func NewConversationsRepository(client *databases.MongoDBConnections, config *configs.Config) *ConversationsRepository { | ||
return &ConversationsRepository{client: client.OpenChat, config: config} | ||
} | ||
|
||
func (c *ConversationsRepository) RetrieveChatroomHistory(chatroomId string, page int, pageSize int) ([]model.Message, error) { | ||
|
||
return nil, nil | ||
} | ||
|
||
func (c *ConversationsRepository) SaveMessageToUser(message model.Message) error { | ||
return nil | ||
} | ||
|
||
func (c *ConversationsRepository) BatchSaveMessage(messages []model.Message) error { | ||
return nil | ||
} | ||
func (c *ConversationsRepository) RetrieveLatestMessageFromUser(userId string) (*model.Message, error) { | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package repositories | ||
|
||
import ( | ||
"go-live-chat/internal/infraestructure/wrappers" | ||
"go.mongodb.org/mongo-driver/mongo/options" | ||
) | ||
|
||
type MongoClientInterface interface { | ||
Database(name string, opts ...*options.DatabaseOptions) wrappers.MongoDatabaseInterface | ||
} |
Oops, something went wrong.