Skip to content

Commit 004185d

Browse files
committed
adds routes
1 parent 3b0daf6 commit 004185d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/restapi/v1/server.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
_ "github.com/lib/pq"
99
"github.com/shinobistack/gokakashi/ent"
1010
"github.com/shinobistack/gokakashi/internal/restapi/server/middleware"
11+
agents1 "github.com/shinobistack/gokakashi/internal/restapi/v1/agents"
12+
agenttasks1 "github.com/shinobistack/gokakashi/internal/restapi/v1/agenttasks"
13+
1114
integrations1 "github.com/shinobistack/gokakashi/internal/restapi/v1/integrations"
1215
integrationtype1 "github.com/shinobistack/gokakashi/internal/restapi/v1/integrationtype"
1316
policies1 "github.com/shinobistack/gokakashi/internal/restapi/v1/policies"
@@ -84,6 +87,18 @@ func (srv *Server) Service() *web.Service {
8487
apiV1.Put("/scans/{scan_id}/labels", usecase.NewInteractor(scanlabels1.UpdateScanLabel(srv.DB)))
8588
apiV1.Delete("/scans/{scan_id}/labels/{key}", usecase.NewInteractor(scanlabels1.DeleteScanLabel(srv.DB)))
8689

90+
apiV1.Post("/agents", usecase.NewInteractor(agents1.CreateAgent(srv.DB)))
91+
apiV1.Get("/agents", usecase.NewInteractor(agents1.ListAgents(srv.DB)))
92+
apiV1.Get("/agents/{id}", usecase.NewInteractor(agents1.GetAgent(srv.DB)))
93+
apiV1.Put("/agents/{id}", usecase.NewInteractor(agents1.UpdateAgent(srv.DB)))
94+
apiV1.Delete("/agents/{id}", usecase.NewInteractor(agents1.DeleteAgent(srv.DB)))
95+
96+
apiV1.Post("/agents/{agent_id}/tasks", usecase.NewInteractor(agenttasks1.CreateAgentTask(srv.DB)))
97+
apiV1.Get("/agents/{agent_id}/tasks", usecase.NewInteractor(agenttasks1.ListAgentTasks(srv.DB)))
98+
apiV1.Get("/agents/{agent_id}/tasks/{id}", usecase.NewInteractor(agenttasks1.GetAgentTask(srv.DB)))
99+
apiV1.Put("/agents/{agent_id}/tasks/{id}", usecase.NewInteractor(agenttasks1.UpdateAgentTask(srv.DB)))
100+
apiV1.Delete("/agents/{agent_id}/tasks/{id}", usecase.NewInteractor(agenttasks1.DeleteAgentTask(srv.DB)))
101+
87102
s.Mount("/api/v1/openapi.json", specHandler(apiV1.OpenAPICollector.SpecSchema().(*openapi31.Spec)))
88103
s.Mount("/api/v1", apiV1)
89104

0 commit comments

Comments
 (0)