2026-06-25 19:57:16 +08:00

49 lines
1.6 KiB
Go

package messageapi
import (
"net/http"
"hyapp/services/gateway-service/internal/client"
"hyapp/services/gateway-service/internal/transport/http/httproutes"
)
// Handler owns message inbox endpoints and safe profile batches used by Tencent IM conversation UI.
// Private chat delivery remains Tencent IM owned; these handlers only expose backend-owned system inbox facts.
type Handler struct {
messageClient client.MessageInboxClient
actionClient client.MessageActionConfirmClient
userProfileClient client.UserProfileClient
}
type Config struct {
MessageClient client.MessageInboxClient
ActionClient client.MessageActionConfirmClient
UserProfileClient client.UserProfileClient
}
func New(config Config) *Handler {
return &Handler{
messageClient: config.MessageClient,
actionClient: config.ActionClient,
userProfileClient: config.UserProfileClient,
}
}
func (h *Handler) MessageHandlers() httproutes.MessageHandlers {
return httproutes.MessageHandlers{
ListMessageTabs: h.listMessageTabs,
MarkInboxSectionRead: h.markInboxSectionRead,
MarkInboxMessageReadPath: h.markInboxMessageReadByPath,
DeleteInboxMessagePath: h.deleteInboxMessageByPath,
ListInboxMessages: h.listInboxMessages,
AcceptActionConfirm: h.acceptActionConfirm,
RejectActionConfirm: h.rejectActionConfirm,
BatchActionConfirmStatus: h.batchActionConfirmStatus,
ListActionConfirms: h.listActionConfirms,
}
}
func (h *Handler) BatchUserProfiles(writer http.ResponseWriter, request *http.Request) {
h.batchUserProfiles(writer, request)
}