2022-06-19 22:02:44 -07:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetDiscordQueue
|
|
|
|
// @Summary Returns the top 100 entries from the queue to be processed.
|
|
|
|
// @Produce application/json
|
2022-07-12 15:28:31 -07:00
|
|
|
// @Tags Debug, Discord, Queue
|
2022-06-19 22:02:44 -07:00
|
|
|
// @Router /discord/queue [get]
|
|
|
|
func (s *Server) GetDiscordQueue(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
|
2022-06-30 14:54:58 -07:00
|
|
|
res, err := s.Db.ListDiscordQueueItems(*s.ctx, 100)
|
2022-06-19 22:02:44 -07:00
|
|
|
if err != nil {
|
|
|
|
w.Write([]byte(err.Error()))
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
bres, err := json.Marshal(res)
|
|
|
|
if err != nil {
|
|
|
|
w.Write([]byte(err.Error()))
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
w.Write(bres)
|
|
|
|
}
|