feat(im): Task 5 - IM REST Controller + Router + Wire 集成

IMController (REST API):
- GET /api/v1/im/conversations: 会话列表
- GET /api/v1/im/messages: 历史消息(游标分页)
- PUT /api/v1/im/conversations/:id/pin: 置顶/取消
- DELETE /api/v1/im/conversations/🆔 删除会话
- DELETE /api/v1/im/conversations/:id/messages: 清空记录
- GET /api/v1/im/messages/search: 全局搜索
- GET /api/v1/im/unread: 全局未读数

Wire 集成:
- IMSet Provider Set + wire.Bind 接口注入
- App struct 新增 IM 字段
- wire_gen.go 手动更新
- OfflinePusher 通过 SetOfflinePusher 注入 WS Handler

Made-with: Cursor
This commit is contained in:
bujinyuan
2026-03-03 10:51:56 +08:00
parent 1e0c061e9d
commit 2c7be494f2
7 changed files with 344 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/echochat/backend/app/admin"
"github.com/echochat/backend/app/auth"
"github.com/echochat/backend/app/contact"
imApp "github.com/echochat/backend/app/im"
"github.com/echochat/backend/app/provider"
wsApp "github.com/echochat/backend/app/ws"
"github.com/echochat/backend/pkg/middleware"
@@ -36,8 +37,8 @@ func Setup(engine *gin.Engine, app *provider.App) {
admin.RegisterRoutes(engine, app.UserManageController, app.OnlineController, app.ContactManageController, jwtAuth)
wsApp.RegisterRoutes(engine, app.WSHandler)
contact.RegisterRoutes(engine, app.ContactController, jwtAuth)
imApp.RegisterRoutes(engine, app.IMController, jwtAuth)
// [未来] im.RegisterRoutes(engine, app.ImController, jwtAuth)
// [未来] meeting.RegisterRoutes(engine, app.MeetingController, jwtAuth)
// [未来] notify.RegisterRoutes(engine, app.NotifyController, jwtAuth)
}