feat(httpapi):lab4 register attachment routes in router
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user