лаба 4 на оценку 5

This commit is contained in:
2026-10-30 12:27:49 +03:00
parent 7860d81fa1
commit f9444a3965
59 changed files with 4696 additions and 90 deletions
+14 -7
View File
@@ -7,15 +7,17 @@ import (
)
type CreateMessageRequest struct {
Text string `json:"text"`
Text string `json:"text"`
AttachmentIDs []string `json:"attachment_ids"`
}
type MessageResponse struct {
ID string `json:"id"`
ChatID string `json:"chat_id"`
SenderID string `json:"sender_id"`
Text string `json:"text"`
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
ChatID string `json:"chat_id"`
SenderID string `json:"sender_id"`
Text string `json:"text"`
AttachmentIDs []string `json:"attachment_ids"`
CreatedAt time.Time `json:"created_at"`
}
type MessagePageResponse struct {
@@ -24,9 +26,14 @@ type MessagePageResponse struct {
}
func MessageFromDomain(message domain.Message) MessageResponse {
attachmentIDs := append([]string(nil), message.AttachmentIDs...)
if attachmentIDs == nil {
attachmentIDs = make([]string, 0)
}
return MessageResponse{
ID: message.ID, ChatID: message.ChatID, SenderID: message.SenderID,
Text: message.Text, CreatedAt: message.CreatedAt,
Text: message.Text, AttachmentIDs: attachmentIDs, CreatedAt: message.CreatedAt,
}
}