message

package
v0.0.0-...-4c36365 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidValidation = errors.New("failed to validate arguments")

	ErrNotFound      = errors.New("not found")
	ErrChatNotFound  = errors.New("chat not found")
	ErrDeleteMessage = errors.New("failed to delete message")
	ErrInsertMessage = errors.New("failed to insert message")
	ErrAccessDenied  = errors.New("access denied")
)

Functions

func HasAccessToDeleteMessage

func HasAccessToDeleteMessage(chatType string, detail interface{}, userID model.UserID, message model.Message) bool

func HasAccessToSendMessage

func HasAccessToSendMessage(chatType string, detail interface{}, userID model.UserID) bool

func ReceiversIDs

func ReceiversIDs(chat *model.Chat) ([]model.UserID, error)

Types

type MessageService

type MessageService struct {
	// contains filtered or unexported fields
}

func NewMessageService

func NewMessageService(logger *log.SubLogger, messageRepo repository.MessageRepository, chatRepo repository.ChatRepository, userRepo repository.UserRepository, eventPublisher stream.StreamPublisher) *MessageService

func (*MessageService) DeleteMessage

func (s *MessageService) DeleteMessage(ctx context.Context, chatID model.ChatID, userID model.UserID, messageID model.MessageID) *vali.Varror

func (*MessageService) FetchMessages

func (s *MessageService) FetchMessages(ctx context.Context, chatID model.ChatID) ([]*model.MessageGetter, *vali.Varror)

func (*MessageService) SendTextMessage

func (s *MessageService) SendTextMessage(ctx context.Context, chatID model.ChatID, userID model.UserID, messageContent string) (*model.MessageGetter, *vali.Varror)

func (*MessageService) UpdateTextMessage

func (s *MessageService) UpdateTextMessage(ctx context.Context, chatID primitive.ObjectID, newMessageContent string) *vali.Varror

TODO - Implement UpdateTextMessage Method For MessageService

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL