Files
kra-new/internal/server/handler/live_chat.go
T
2026-09-22 12:04:22 +08:00

29 lines
776 B
Go

package handler
import (
"github.com/gin-gonic/gin"
"kra/internal/service/dto"
service "kra/internal/service/livechat"
)
type LiveChat struct{ service *service.Service }
func NewLiveChat(service *service.Service) *LiveChat { return &LiveChat{service: service} }
func (h *LiveChat) History(c *gin.Context) {
roomID, ok := businessID(c)
if !ok {
return
}
// Chat is intentionally scoped to the current live connection. Do not
// replay rows persisted by an earlier viewer/session through HTTP. Still
// validate the room so callers receive a useful not-found response.
items, err := h.service.History(c.Request.Context(), roomID, 1)
if err != nil {
businessFail(c, err)
return
}
_ = items
OKWithData(c, gin.H{"list": []*dto.LiveChatMessageResponse{}})
}