From 0a72eab1daad5dad216f229744b1a2d9a34f4cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=BE=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=20Maximillian?= =?UTF-8?q?=20=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 22 Oct 2026 13:10:08 +0300 Subject: [PATCH] feat(httpapi):lab4 register attachment routes in router --- backend/internal/httpapi/router.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/internal/httpapi/router.go b/backend/internal/httpapi/router.go index 8da3087..a614a01 100644 --- a/backend/internal/httpapi/router.go +++ b/backend/internal/httpapi/router.go @@ -8,11 +8,12 @@ import ( ) type Handlers struct { - Health *handler.HealthHandler - User *handler.UserHandler - Chat *handler.ChatHandler - Message *handler.MessageHandler - Auth *handler.AuthHandler + Health *handler.HealthHandler + User *handler.UserHandler + Chat *handler.ChatHandler + Message *handler.MessageHandler + Auth *handler.AuthHandler + Attachment *handler.AttachmentHandler } func NewRouter(h Handlers, auth gin.HandlerFunc) *gin.Engine { @@ -44,6 +45,12 @@ func NewRouter(h Handlers, auth gin.HandlerFunc) *gin.Engine { protected.GET("/chats/:chat_id", h.Chat.Get) protected.POST("/chats/:chat_id/messages", h.Message.Create) protected.GET("/chats/:chat_id/messages", h.Message.List) + + if h.Attachment != nil { + protected.POST("/chats/:chat_id/attachments", h.Attachment.Upload) + protected.GET("/attachments/:attachment_id", h.Attachment.Get) + protected.GET("/attachments/:attachment_id/content", h.Attachment.Content) + } } return r