41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain"
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain/models"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
type ListDiscordWebHooksQueueResults struct {
|
|
ApiStatusModel
|
|
Payload []models.DiscordQueueDetailsDto `json:"payload"`
|
|
}
|
|
|
|
// GetDiscordQueue
|
|
// @Summary Returns the top 100 entries from the queue to be processed.
|
|
// @Produce application/json
|
|
// @Tags Queue
|
|
// @Router /queue/discord/webhooks [get]
|
|
// @Success 200 {object} ListDiscordWebHooksQueueResults "ok"
|
|
func (s *Handler) ListDiscordWebhookQueue(c echo.Context) error {
|
|
p := ListDiscordWebHooksQueueResults{
|
|
ApiStatusModel: ApiStatusModel{
|
|
Message: "OK",
|
|
StatusCode: http.StatusOK,
|
|
},
|
|
}
|
|
|
|
// Get the raw resp from sql
|
|
res, err := s.dto.ListDiscordWebhookQueueDetails(c.Request().Context(), 50)
|
|
if err != nil {
|
|
return c.JSON(http.StatusInternalServerError, domain.ErrorResponse{
|
|
Message: err.Error(),
|
|
})
|
|
}
|
|
|
|
p.Payload = res
|
|
return c.JSON(http.StatusOK, p)
|
|
}
|