narasiahli-be/app/module/communications/response/communications.response.go

57 lines
1.7 KiB
Go

package response
import (
"time"
)
// Conversations Response DTOs
type ConversationsResponse struct {
ID uint `json:"id"`
Participant1ID uint `json:"participant1Id"`
Participant2ID uint `json:"participant2Id"`
LastMessageAt *time.Time `json:"lastMessageAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
// Nested user info
Participant1 *UserBasicInfo `json:"participant1,omitempty"`
Participant2 *UserBasicInfo `json:"participant2,omitempty"`
// Last message preview
LastMessage *ChatMessagesResponse `json:"lastMessage,omitempty"`
// Unread count
UnreadCount int `json:"unreadCount"`
}
// Chat Messages Response DTOs
type ChatMessagesResponse struct {
ID uint `json:"id"`
ConversationID uint `json:"conversationId"`
SenderID uint `json:"senderId"`
MessageText *string `json:"messageText"`
MessageType string `json:"messageType"`
FileURL *string `json:"fileUrl"`
FileName *string `json:"fileName"`
FileSize *int64 `json:"fileSize"`
IsRead bool `json:"isRead"`
CreatedAt time.Time `json:"createdAt"`
// Nested user info
Sender *UserBasicInfo `json:"sender,omitempty"`
}
type UserBasicInfo struct {
ID uint `json:"id"`
Username string `json:"username"`
Fullname string `json:"fullname"`
Email string `json:"email"`
}
// Conversation with messages
type ConversationWithMessagesResponse struct {
Conversation *ConversationsResponse `json:"conversation"`
Messages []*ChatMessagesResponse `json:"messages"`
Pagination interface{} `json:"pagination"`
}