chat

package
v0.0.0-...-e91a5b0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddParticipantsRequest

type AddParticipantsRequest struct {
	ConversationID int64
	UserID         int64
}

type ChatService

type ChatService interface {
	CreatePrivateConversation(ctx context.Context, req *NewChatRequest) error
	FetchConversations(ctx context.Context) ([]*ConversationSummary, error)
	FetchConversation(ctx context.Context, id int64) ([]*Message, error)
	FetchContversationInfo(ctx context.Context, id int64) (*ConversationInfo, error)
	RemovePrivateConversation(ctx context.Context, id int64) error

	CreateGroupConversation(ctx context.Context, req *NewGroupChatRequest) error
	RemoveGroupConversation(ctx context.Context, req *LeaveGroupChatRequest) error
	AddParticipants(ctx context.Context, req *AddParticipantsRequest) error
	RemoveParticipants(ctx context.Context, req *RemoveParticipantsRequest) error

	RemoveMessage(ctx context.Context, req *RemoveMessageRequest) error
	EditMessage(ctx context.Context, req *EditMessageRequest) error
	// contains filtered or unexported methods
}

type Conversation

type Conversation struct {
	ID             int64
	IsPrivate      bool   `json:"isPrivate"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	PrivateMembers string `json:"-"`
	ImagePath      string `json:"imagePath"`
	CreatedAt      time.Time
	CreatedBy      int64
}

---------------- Models ----------------

type ConversationInfo

type ConversationInfo struct {
	ID               int64      `json:"id"`
	ConversationName string     `json:"conversationName"`
	IsPrivate        bool       `json:"isPrivate"`
	ImagePath        string     `json:"imagePath"`
	Members          []UserView `json:"members"`
}

type ConversationSummary

type ConversationSummary struct {
	ID               int64     `json:"id"`
	ConversationName string    `json:"conversationName"`
	IsPrivate        bool      `json:"isPrivate"`
	ImagePath        string    `json:"imagePath"`
	LastRead         time.Time `json:"lastRead"`
	UnreadMessages   int       `json:"unreadMessages" gorm:"-"`
	LastMessage      Message   `json:"lastMessage" gorm:"-"`
	LastUpdate       time.Time `json:"lastUpdate" gorm:"-"`
}

type EditMessageRequest

type EditMessageRequest struct {
	ConversationID int64
	MessageID      int64
}

type LeaveGroupChatRequest

type LeaveGroupChatRequest struct {
	ConversationID int64
	DeleteGroup    bool
}

type Message

type Message struct {
	ID             int64             `json:"messageID" bson:"_id"`
	ConversationID int64             `json:"conversationId" bson:"conversation_id"`
	SenderID       int64             `json:"senderId" bson:"sender_id"`
	SenderName     string            `json:"senderName" bson:"sender_name"`
	Content        map[string]string `json:"content" bson:"content"`
	CreatedAt      time.Time         `json:"createdAt" bson:"created_at,inline"`
	EditedAt       time.Time         `json:"editedAt" bson:"edited_at"`
}

type NewChatRequest

type NewChatRequest struct {
	ReceiverID int64
}

type NewGroupChatRequest

type NewGroupChatRequest struct {
	ImagePath string
	Members   []int64
}

type RemoveChatRequest

type RemoveChatRequest struct {
	ConversationID int64
}

type RemoveMessageRequest

type RemoveMessageRequest struct {
	ConversationID int64
	MessageID      int64
}

type RemoveParticipantsRequest

type RemoveParticipantsRequest struct {
	ConversationID int64
	UserID         int64
}

type UnImplementedChatService

type UnImplementedChatService struct{}

func (UnImplementedChatService) AddParticipants

func (UnImplementedChatService) CreateGroupConversation

func (UnImplementedChatService) CreateGroupConversation(ctx context.Context, req *NewGroupChatRequest) error

func (UnImplementedChatService) CreatePrivateConversation

func (UnImplementedChatService) CreatePrivateConversation(ctx context.Context, req *NewChatRequest) error

func (UnImplementedChatService) EditMessage

func (UnImplementedChatService) FetchContversationInfo

func (UnImplementedChatService) FetchContversationInfo(ctx context.Context, id int64) (*ConversationInfo, error)

func (UnImplementedChatService) FetchConversation

func (UnImplementedChatService) FetchConversation(ctx context.Context, id int64) ([]*Message, error)

func (UnImplementedChatService) FetchConversations

func (UnImplementedChatService) FetchConversations(ctx context.Context) ([]*ConversationSummary, error)

func (UnImplementedChatService) RemoveGroupConversation

func (UnImplementedChatService) RemoveGroupConversation(ctx context.Context, req *LeaveGroupChatRequest) error

func (UnImplementedChatService) RemoveMessage

func (UnImplementedChatService) RemoveParticipants

func (UnImplementedChatService) RemovePrivateConversation

func (UnImplementedChatService) RemovePrivateConversation(ctx context.Context, req *RemoveChatRequest) error

type UserConversation

type UserConversation struct {
	ID             int64
	UserID         int64     `json:"userId"`
	ConversationID int64     `json:"conversationID"`
	Role           int32     `json:"role" gorm:"col:role_c"`
	LastRead       time.Time `json:"lastRead"`
	JoinedSince    time.Time `json:"joinedSince"`
}

type UserView

type UserView struct {
	user.UserSummary
	Role int32 `json:"role"`
}

Jump to

Keyboard shortcuts

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