inbox

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InboxService

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

func NewInboxService

func NewInboxService(db *gorm.DB, ctx *context.ERPContext) *InboxService

NewInboxService creates a new instance of InboxService with the given database connection and context. Use this function to create a new InboxService instance, which can be used to interact with the inbox-related database tables.

func (*InboxService) CountUnread

func (s *InboxService) CountUnread(userID *string, memberID *string) (int64, error)

CountUnread counts the unread messages for the specified user or member.

It accepts optional user and member IDs and returns the count of unread messages and an error if the operation fails.

func (*InboxService) CountUnreadSendMessage

func (s *InboxService) CountUnreadSendMessage(userID *string, memberID *string) (int64, error)

CountUnreadSendMessage counts the unread sent messages for the specified user or member.

It accepts optional user and member IDs and returns the count of unread sent messages and an error if the operation fails.

func (*InboxService) DeleteMessage

func (s *InboxService) DeleteMessage(inboxMessageID string, userID *string, memberID *string) error

DeleteMessage moves the specified message to the trash for the given user or member.

It accepts the message ID, and optional user and member IDs, and returns an error if the operation fails.

func (*InboxService) GetDefaultInbox

func (s *InboxService) GetDefaultInbox(userID *string, memberID *string) (*models.InboxModel, error)

GetDefaultInbox retrieves the default inbox for a given user or member.

It accepts a user ID and a member ID as parameters, either of which may be nil. If the user ID is provided, the function searches for the default inbox associated with that user. If the member ID is provided, it searches for the default inbox associated with that member. The function returns the found InboxModel and a nil error if successful, or a nil InboxModel and an error if the inbox is not found or if a database error occurs during the query.

func (*InboxService) GetInboxMessageDetail

func (s *InboxService) GetInboxMessageDetail(inboxMessageID string) (*models.InboxMessageModel, error)

GetInboxMessageDetail retrieves the details of a specific inbox message, including its replies.

It accepts the message ID and returns the InboxMessageModel object with details and an error if the operation fails.

func (*InboxService) GetInboxes

func (s *InboxService) GetInboxes(userID *string, memberID *string) ([]models.InboxModel, error)

GetInboxes retrieves a list of inbox models from the database for the given user ID and member ID. The function filters the inboxes by the given user ID and member ID. If the user ID and member ID are both nil, the function returns an empty list. If the user ID is not nil, the function returns the inboxes for the given user ID. If the member ID is not nil, the function returns the inboxes for the given member ID. If the user ID and member ID are not nil, the function returns the inboxes that match both the user ID and member ID. The function also creates a default inbox and a trash inbox if they do not exist, and returns them in the list.

func (*InboxService) GetMessageByInboxID

func (s *InboxService) GetMessageByInboxID(request http.Request, search string, inboxID *string) (paginate.Page, error)

GetMessageByInboxID retrieves a paginated list of messages for a given inbox ID.

If the inbox ID is provided, it only returns messages that are not replies and are addressed to the inbox. If the inbox is associated with a member, it also returns messages that are replies to messages in the inbox and addressed to the member.

The search parameter is optional and is used to filter the results by subject or message content. The function uses request parameters to modify the pagination and filtering behavior.

The function returns a paginated page of InboxMessageModel objects and an error if the operation fails, allowing the caller to handle any database-related issues that might occur during the query process.

func (*InboxService) GetSentMessages

func (s *InboxService) GetSentMessages(request http.Request, search string, userID *string, memberID *string) (paginate.Page, error)

GetSentMessages retrieves a paginated list of sent messages for the specified user or member.

It accepts an HTTP request, a search string, and optional user and member IDs for filtering. The function returns a paginated page of InboxMessageModel objects and an error if the operation fails.

func (*InboxService) SendMessage

func (s *InboxService) SendMessage(data *models.InboxMessageModel) error

Jump to

Keyboard shortcuts

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