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{}}) }