From a21b6a8ff2010837ede306fdbd916f430d7a6861 Mon Sep 17 00:00:00 2001 From: Maximillian Date: Sat, 10 Oct 2026 11:36:53 +0300 Subject: [PATCH] fix(api): accept attachment_ids in message DTO and validate cursor uuid --- backend/internal/httpapi/dto/message.go | 3 ++- backend/internal/storage/postgres/cursor.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/internal/httpapi/dto/message.go b/backend/internal/httpapi/dto/message.go index 31f9471d..8cb70b85 100644 --- a/backend/internal/httpapi/dto/message.go +++ b/backend/internal/httpapi/dto/message.go @@ -5,7 +5,8 @@ import ( ) type CreateMessageRequest struct { - Text string `json:"text" binding:"required,min=1,max=4000"` + Text string `json:"text" binding:"required,min=1,max=4000"` + AttachmentIDs []string `json:"attachment_ids"` } type MessageResponse struct { diff --git a/backend/internal/storage/postgres/cursor.go b/backend/internal/storage/postgres/cursor.go index 4349c070..044ffeea 100644 --- a/backend/internal/storage/postgres/cursor.go +++ b/backend/internal/storage/postgres/cursor.go @@ -6,6 +6,8 @@ import ( "time" "high-loud-apps-labs/internal/domain" + + "github.com/google/uuid" ) // Взял за основу что в inmemery делал @@ -30,6 +32,9 @@ func decodeCursor(cursor, expectedScope string) (time.Time, string, error) { if err != nil { return time.Time{}, "", badCursor() } + if _, err := uuid.Parse(parts[2]); err != nil { + return time.Time{}, "", badCursor() + } return t, parts[2], nil }