James Tombleson
713205bb03
* basic routes are working with db context * swagger is working along with swag gen * cron was updated with a class and better db context, untested though * sourcelist command added * lost the pg package but added it back * Updated the api startup for cron and api * updated source routes and started to add article routes * Updated cron add func calls * updated swagger * keeping articles basic for now as I dont need to pull them in yet * swagger update * added getarticlesbysourceid call * adding the subscriptions table to track who to send notifications and where * removed legacy columns from discordwebhooks that are no longer needed. * added discord webhook routes * updated routes * Minor change to schema * Updated routes to support subscriptions * ignore .vscode
29 lines
607 B
Go
29 lines
607 B
Go
package routes
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// GetDiscordQueue
|
|
// @Summary Returns the top 100 entries from the queue to be processed.
|
|
// @Produce application/json
|
|
// @Tags debug, Discord, Queue
|
|
// @Router /discord/queue [get]
|
|
func (s *Server) GetDiscordQueue(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
res, err := s.Db.GetDiscordQueueItems(*s.ctx, 100)
|
|
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)
|
|
} |