Restructure the monorepo into clear top-level directories: - backend/: Go module root (cmd, internal, pkg, configs, migrations, docs/swagger, scripts, tests, go.mod, Makefile, .air.toml) - deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd - docs/: project documentation + reports/ (moved from repo root) - AGENTS.md: new AI coding-agent guide at repo root Update all references to the new layout: - Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root) - docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile, env_file ../../.env, volume mounts ../../backend:/app - deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile - CI: working-directory: backend for go commands, file deploy/docker/Dockerfile, coverage path backend/coverage.out, health_check backend/scripts/ - backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../ - README: architecture tree, quickstart, config paths updated Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh, gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to preserve history. Build, vet, SQLite tests, and docker compose config verified.
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/gochat/gochat/internal/service"
|
|
"github.com/gochat/gochat/pkg/response"
|
|
)
|
|
|
|
// DeliveryStatusHandler handles message delivery status endpoints.
|
|
// Reference: Chatwoot message delivery status per recipient tracking
|
|
// GET /api/v1/accounts/:account_id/conversations/:conversation_id/messages/:message_id/delivery_status
|
|
type DeliveryStatusHandler struct {
|
|
svc *service.DeliveryStatusService
|
|
}
|
|
|
|
// NewDeliveryStatusHandler creates a new DeliveryStatusHandler.
|
|
func NewDeliveryStatusHandler(svc *service.DeliveryStatusService) *DeliveryStatusHandler {
|
|
return &DeliveryStatusHandler{svc: svc}
|
|
}
|
|
|
|
// List retrieves all delivery statuses for a given message.
|
|
// GET /api/v1/accounts/:account_id/conversations/:conversation_id/messages/:message_id/delivery_status
|
|
func (h *DeliveryStatusHandler) List(c *gin.Context) {
|
|
accountID, err := parseUintParam(c, "account_id")
|
|
if err != nil {
|
|
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid account_id")
|
|
return
|
|
}
|
|
|
|
conversationID, err := parseUintParam(c, "conversation_id")
|
|
if err != nil {
|
|
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid conversation_id")
|
|
return
|
|
}
|
|
|
|
messageID, err := parseUintParam(c, "message_id")
|
|
if err != nil {
|
|
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid message_id")
|
|
return
|
|
}
|
|
|
|
statuses, svcErr := h.svc.ListByMessage(c.Request.Context(), accountID, conversationID, messageID)
|
|
if svcErr != nil {
|
|
handleServiceError(c, svcErr)
|
|
return
|
|
}
|
|
|
|
response.OK(c, statuses)
|
|
} |