Documentation ¶
Overview ¶
messagebusiness contains the business logic for message operations.
Index ¶
- type MessageService
- func (ms *MessageService) CheckThreadExists(threadID uuid.UUID) (bool, error)
- func (ms *MessageService) CreateMessage(userID uuid.UUID, message *messagemodel.ChatMessage) error
- func (ms *MessageService) CreateThread(thread *messagemodel.ChatThread) error
- func (ms *MessageService) DeleteThread(threadID uuid.UUID, userID uuid.UUID) error
- func (ms *MessageService) GetAllThreads(userID uuid.UUID) ([]messagemodel.ChatThread, error)
- func (ms *MessageService) GetMessagesByThreadID(threadID uuid.UUID, limit, offset int, userID uuid.UUID) ([]messagemodel.ChatMessageResponse, error)
- func (ms *MessageService) GetThreadByID(threadID uuid.UUID) (*messagemodel.ChatThread, error)
- func (ms *MessageService) GetThreadsByUserID(userID uuid.UUID, limit, offset int) ([]messagemodel.ChatThread, error)
- func (ms *MessageService) IsUserThreadOwner(threadID, userID uuid.UUID) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageService ¶
type MessageService struct {
// contains filtered or unexported fields
}
MessageService provides methods for message operations.
func NewMessageService ¶
func NewMessageService(messageStore messagestorage.MessageStore) *MessageService
NewMessageService creates a new MessageService.
func (*MessageService) CheckThreadExists ¶
func (ms *MessageService) CheckThreadExists(threadID uuid.UUID) (bool, error)
CheckThreadExists verifies if a thread exists in the database.
func (*MessageService) CreateMessage ¶
func (ms *MessageService) CreateMessage(userID uuid.UUID, message *messagemodel.ChatMessage) error
CreateMessage adds a new message to a chat thread.
func (*MessageService) CreateThread ¶
func (ms *MessageService) CreateThread(thread *messagemodel.ChatThread) error
CreateThread handles the creation of a new chat thread.
func (*MessageService) DeleteThread ¶
DeleteThread deletes a chat thread.
func (*MessageService) GetAllThreads ¶
func (ms *MessageService) GetAllThreads(userID uuid.UUID) ([]messagemodel.ChatThread, error)
GetAllThreads retrieves all chat threads for a specific user.
func (*MessageService) GetMessagesByThreadID ¶
func (ms *MessageService) GetMessagesByThreadID(threadID uuid.UUID, limit, offset int, userID uuid.UUID) ([]messagemodel.ChatMessageResponse, error)
GetMessagesByThreadID retrieves messages of a chat thread with pagination.
func (*MessageService) GetThreadByID ¶
func (ms *MessageService) GetThreadByID(threadID uuid.UUID) (*messagemodel.ChatThread, error)
GetThreadByID retrieves a chat thread by its ID.
func (*MessageService) GetThreadsByUserID ¶
func (ms *MessageService) GetThreadsByUserID(userID uuid.UUID, limit, offset int) ([]messagemodel.ChatThread, error)
GetThreadsByUserID retrieves all chat threads for a specific user.
func (*MessageService) IsUserThreadOwner ¶
func (ms *MessageService) IsUserThreadOwner(threadID, userID uuid.UUID) bool