Добавьте S3-вложения с дедупликацией и безопасной сверкой хранилищ
This commit is contained in:
@@ -12,6 +12,8 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"messenger/internal/attachment"
|
||||
attachmentstore "messenger/internal/attachment/store"
|
||||
"messenger/internal/auth"
|
||||
authstore "messenger/internal/auth/store"
|
||||
"messenger/internal/chat"
|
||||
@@ -42,6 +44,9 @@ type Deps struct {
|
||||
InstanceID string
|
||||
// IdempotencyTTL zero means the contract's 24 hours.
|
||||
IdempotencyTTL time.Duration
|
||||
Blobs attachment.Blobs
|
||||
MaxUploadBytes int64
|
||||
MaxImagePixels int64
|
||||
}
|
||||
|
||||
// defaultRequestTimeout stays below the server's 10s write timeout, so a
|
||||
@@ -76,6 +81,9 @@ func New(d Deps) *App {
|
||||
auth.NewHandler(sessions).Register(public, protected)
|
||||
user.NewHandler(users).Register(public, protected)
|
||||
chat.NewHandler(chats).Register(protected)
|
||||
attachments := attachment.NewService(attachmentstore.NewAttachments(d.DB, d.Blobs), d.Blobs, d.MaxUploadBytes, d.MaxImagePixels)
|
||||
binary := engine.Group("/api/v1", httpx.Timeout(30*time.Second), auth.RequireSession(sessions))
|
||||
attachment.NewHandler(attachments).Register(protected, binary)
|
||||
|
||||
return &App{Engine: engine, Health: probes, Chats: chats}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user