feat: add minio

This commit is contained in:
TAskMAster339
2026-10-18 18:06:27 +03:00
parent 9bbd342756
commit e3cd2516ba
30 changed files with 1213 additions and 177 deletions
+9 -5
View File
@@ -10,7 +10,7 @@ import (
)
type createMessageRequest struct {
Text string `json:"text"`
Text *string `json:"text"`
AttachmentIDs json.RawMessage `json:"attachment_ids"`
}
@@ -62,10 +62,14 @@ func createMessageHandler(chats *services.ChatService, messages *services.Messag
writeError(w, 400, "invalid_request", "invalid JSON body", requestID)
return
}
ids := []string{}
if request.Text == nil {
writeError(w, 400, "invalid_request", "text must be a string", requestID)
return
}
if len(request.AttachmentIDs) > 0 {
var ids []string
if err := json.Unmarshal(request.AttachmentIDs, &ids); err != nil || ids == nil || len(ids) != 0 {
writeError(w, 400, "invalid_request", "attachments are not supported in lab3; use an empty array or omit attachment_ids", requestID)
if err := json.Unmarshal(request.AttachmentIDs, &ids); err != nil || ids == nil {
writeError(w, 400, "invalid_request", "attachment_ids must be an array of UUIDs", requestID)
return
}
}
@@ -74,7 +78,7 @@ func createMessageHandler(chats *services.ChatService, messages *services.Messag
writeError(w, 400, "invalid_request", "exactly one Idempotency-Key is required", requestID)
return
}
message, err := messages.CreateIdempotent(r.Context(), userID, chat, request.Text, keys[0])
message, err := messages.CreateIdempotent(r.Context(), userID, chat, *request.Text, keys[0], ids)
if err != nil {
writeServiceError(w, err, requestID)
return