feat(backend): implement job storage; tie everything up
ci-agent / build (push) Failing after 1m55s

This commit is contained in:
2026-04-04 05:09:16 +03:00
parent f578b6eb51
commit c5e35b4c12
5 changed files with 209 additions and 33 deletions
+16 -1
View File
@@ -1,12 +1,18 @@
package handlers
import (
"gitea.d3m0k1d.ru/d3m0k1d/HellreigN/backend/internal/grpcsrv/commander"
"github.com/gin-gonic/gin"
"net/http"
)
type AgentsGroup struct {
*Handlers
cmder *commander.Commander
}
func NewAgentsGroup(h *Handlers, cmder *commander.Commander) AgentsGroup {
return AgentsGroup{Handlers: h, cmder: cmder}
}
type AgentInfo struct {
@@ -22,5 +28,14 @@ type AgentInfo struct {
// @Success 200 {array} AgentInfo
// @Router /agents [get]
func (ag *AgentsGroup) List(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Agents list"})
agents := make([]AgentInfo, 0)
// iterate over the commander's agents map
for _, agent := range ag.cmder.Agents() {
agents = append(agents, AgentInfo{
Token: agent.Token,
Label: agent.Label,
Services: agent.Services,
})
}
c.JSON(http.StatusOK, agents)
}