lab4 done
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/attachment"
|
||||
"log"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
@@ -13,10 +14,11 @@ import (
|
||||
|
||||
// Chat is the HTTP handler and depends only on the application boundary.
|
||||
type Chat struct {
|
||||
instanceID string
|
||||
draining atomic.Bool
|
||||
useCase UseCase
|
||||
cursor cursorCodec
|
||||
attachments *attachment.Service
|
||||
instanceID string
|
||||
draining atomic.Bool
|
||||
useCase UseCase
|
||||
cursor cursorCodec
|
||||
}
|
||||
|
||||
func NewChat(useCase UseCase, cursorKey [32]byte) *Chat {
|
||||
@@ -81,6 +83,11 @@ func (h *Chat) Router() *echo.Echo {
|
||||
api.GET("/chats/:chat_id", h.getChat)
|
||||
api.POST("/chats/:chat_id/messages", h.createMessage)
|
||||
api.GET("/chats/:chat_id/messages", h.listMessages)
|
||||
if h.attachments != nil {
|
||||
api.POST("/chats/:chat_id/attachments", h.uploadAttachment)
|
||||
api.GET("/attachments/:attachment_id", h.getAttachment)
|
||||
api.GET("/attachments/:attachment_id/content", h.attachmentContent)
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user