All checks were successful
Dev Build / build-test (pull_request) Successful in 2m23s
- Create repository/ package with pgx-backed CRUD for agents, sessions, tasks, projects - Define AgentRepo/SessionRepo/TaskRepo/ProjectRepo interfaces - Update handler to use repository interfaces instead of in-memory stores - Add SSE broker with GET /api/events endpoint (text/event-stream) - Add gateway client that polls OpenClaw for agent states - Add GATEWAY_URL and GATEWAY_POLL_INTERVAL config fields - Seed 5 demo agents (Otto, Rex, Dex, Hex, Pip) on empty DB - Update router to wire SSE broker - All 21 handler tests pass with mock repos
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"code.cubecraftcreations.com/CubeCraft-Creations/Control-Center/go-backend/internal/models"
|
|
)
|
|
|
|
// AgentRepo is the interface for agent persistence operations.
|
|
type AgentRepo interface {
|
|
Create(ctx context.Context, a models.AgentCardData) error
|
|
Get(ctx context.Context, id string) (models.AgentCardData, error)
|
|
List(ctx context.Context, statusFilter models.AgentStatus) ([]models.AgentCardData, error)
|
|
Update(ctx context.Context, id string, req models.UpdateAgentRequest) (models.AgentCardData, error)
|
|
Delete(ctx context.Context, id string) error
|
|
Count(ctx context.Context) (int, error)
|
|
}
|
|
|
|
// SessionRepo is the interface for session persistence operations.
|
|
type SessionRepo interface {
|
|
Create(ctx context.Context, s models.Session) (models.Session, error)
|
|
ListActive(ctx context.Context) ([]models.Session, error)
|
|
Count(ctx context.Context) (int, error)
|
|
}
|
|
|
|
// TaskRepo is the interface for task persistence operations.
|
|
type TaskRepo interface {
|
|
Create(ctx context.Context, t models.Task) (models.Task, error)
|
|
ListRecent(ctx context.Context) ([]models.Task, error)
|
|
Count(ctx context.Context) (int, error)
|
|
}
|
|
|
|
// ProjectRepo is the interface for project persistence operations.
|
|
type ProjectRepo interface {
|
|
Create(ctx context.Context, p models.Project) (models.Project, error)
|
|
List(ctx context.Context) ([]models.Project, error)
|
|
Count(ctx context.Context) (int, error)
|
|
}
|