ЛР4 - БВТ2303 - Голиков- на 4 #13

Closed
Maximillan_Mercer wants to merge 64 commits from Maximillan_Mercer/mtusi2026lab4-fork:solution/BVT2303-Golikov into main
Showing only changes of commit d3cc2113fe - Show all commits
+16 -10
View File
@@ -10,11 +10,12 @@ type CreateMessageRequest struct {
}
type MessageResponse struct {
ID string `json:"id"`
ChatID string `json:"chat_id"`
SenderID string `json:"sender_id"`
Text string `json:"text"`
CreatedAt string `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 string `json:"created_at"`
}
type MessagePageResponse struct {
@@ -23,12 +24,17 @@ type MessagePageResponse struct {
}
func MessageFromDomain(m *domain.Message) MessageResponse {
ids := m.AttachmentIDs
if ids == nil {
ids = []string{}
}
return MessageResponse{
ID: m.ID,
ChatID: m.ChatID,
SenderID: m.SenderID,
Text: m.Text,
CreatedAt: m.CreatedAt.UTC().Format(timeFormat),
ID: m.ID,
ChatID: m.ChatID,
SenderID: m.SenderID,
Text: m.Text,
AttachmentIDs: ids,
CreatedAt: m.CreatedAt.UTC().Format(timeFormat),
}
}