fix: update env and PR template

This commit is contained in:
TAskMAster339
2026-10-10 22:35:17 +03:00
parent 715f6c4175
commit 18b3627ec8
22 changed files with 450 additions and 77 deletions
+6
View File
@@ -99,6 +99,12 @@ func DecodeChatCursor(value string) (repositories.ChatCursor, error) {
if cursor.UserID == "" || cursor.ChatID == "" || cursor.CreatedAt.IsZero() {
return repositories.ChatCursor{}, strconv.ErrSyntax
}
if _, err := uuid.Parse(cursor.UserID); err != nil {
return repositories.ChatCursor{}, err
}
if _, err := uuid.Parse(cursor.ChatID); err != nil {
return repositories.ChatCursor{}, err
}
return cursor, nil
}
+7
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"strconv"
"github.com/google/uuid"
"messenger/src/backend/repositories"
)
@@ -42,6 +43,12 @@ func DecodeMessageCursor(value string) (repositories.MessageCursor, error) {
if cursor.ChatID == "" || cursor.MessageID == "" || cursor.CreatedAt.IsZero() {
return repositories.MessageCursor{}, strconv.ErrSyntax
}
if _, err := uuid.Parse(cursor.ChatID); err != nil {
return repositories.MessageCursor{}, err
}
if _, err := uuid.Parse(cursor.MessageID); err != nil {
return repositories.MessageCursor{}, err
}
return cursor, nil
}
+1 -1
View File
@@ -25,7 +25,7 @@ func SessionTTL() (time.Duration, error) {
return time.Hour, nil
}
seconds, err := strconv.Atoi(value)
if err != nil || seconds < 1 {
if err != nil || seconds < 1 || seconds > 31536000 {
return 0, errors.New("invalid SESSION_TTL_SECONDS")
}
return time.Duration(seconds) * time.Second, nil