63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package chat
|
|
|
|
import "time"
|
|
|
|
type Principal struct {
|
|
Type string
|
|
ID uint64
|
|
}
|
|
|
|
type ConversationDTO struct {
|
|
ID uint64 `json:"id"`
|
|
OrderID uint64 `json:"order_id"`
|
|
Type string `json:"type"`
|
|
Title string `json:"title"`
|
|
Status string `json:"status"`
|
|
Role string `json:"role"`
|
|
Participants []ParticipantDTO `json:"participants,omitempty"`
|
|
LastMessageID *uint64 `json:"last_message_id"`
|
|
LastMessagePreview string `json:"last_message_preview"`
|
|
LastMessageAt *time.Time `json:"last_message_at"`
|
|
UnreadCount int64 `json:"unread_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ParticipantDTO struct {
|
|
ID uint64 `json:"id"`
|
|
ConversationID uint64 `json:"conversation_id"`
|
|
ParticipantType string `json:"participant_type"`
|
|
ParticipantID uint64 `json:"participant_id"`
|
|
Role string `json:"role"`
|
|
DisplayName string `json:"display_name"`
|
|
AvatarURL string `json:"avatar_url"`
|
|
LastReadAt *time.Time `json:"last_read_at"`
|
|
JoinedAt time.Time `json:"joined_at"`
|
|
}
|
|
|
|
type MessageDTO struct {
|
|
ID uint64 `json:"id"`
|
|
ConversationID uint64 `json:"conversation_id"`
|
|
SenderType string `json:"sender_type"`
|
|
SenderID uint64 `json:"sender_id"`
|
|
SenderRole string `json:"sender_role"`
|
|
SenderName string `json:"sender_name"`
|
|
SenderAvatar string `json:"sender_avatar"`
|
|
IsSelf bool `json:"is_self"`
|
|
ContentType string `json:"content_type"`
|
|
Content string `json:"content"`
|
|
AttachmentURLS []string `json:"attachment_urls"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type SendMessageRequest struct {
|
|
Content string `json:"content" binding:"required"`
|
|
}
|
|
|
|
type PaginatedResult struct {
|
|
Items interface{} `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
}
|