Remove unused gRPC and JWT related code, including Woodpecker service definitions and JWT token management.
This commit is contained in:
30
internal/dto/agent.go
Normal file
30
internal/dto/agent.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
type AgentStatus string
|
||||
|
||||
const (
|
||||
AgentStatusOnline AgentStatus = "online"
|
||||
AgentStatusOffline AgentStatus = "offline"
|
||||
AgentStatusBusy AgentStatus = "busy"
|
||||
)
|
||||
|
||||
type Agent struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Platform string `json:"platform"`
|
||||
Backend string `json:"backend"`
|
||||
Version string `json:"version"`
|
||||
Capacity int32 `json:"capacity"`
|
||||
Status AgentStatus `json:"status"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM float64 `json:"ram"`
|
||||
LastHeartbeat time.Time `json:"last_heartbeat"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
type AgentWithStats struct {
|
||||
*Agent
|
||||
ActiveJobCount int64 `json:"active_job_count"`
|
||||
}
|
||||
46
internal/dto/job.go
Normal file
46
internal/dto/job.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package dto
|
||||
|
||||
import "stream.api/internal/database/model"
|
||||
|
||||
type JobStatus string
|
||||
|
||||
const (
|
||||
JobStatusPending JobStatus = "pending"
|
||||
JobStatusRunning JobStatus = "running"
|
||||
JobStatusSuccess JobStatus = "success"
|
||||
JobStatusFailure JobStatus = "failure"
|
||||
JobStatusCancelled JobStatus = "cancelled"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultJobPageSize = 20
|
||||
MaxJobPageSize = 100
|
||||
JobCursorVersion = 1
|
||||
)
|
||||
|
||||
type PaginatedJobs struct {
|
||||
Jobs []*model.Job `json:"jobs"`
|
||||
Total int64 `json:"total"`
|
||||
Offset int `json:"offset"`
|
||||
Limit int `json:"limit"`
|
||||
HasMore bool `json:"has_more"`
|
||||
NextCursor string `json:"next_cursor,omitempty"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
type JobListCursor struct {
|
||||
Version int `json:"v"`
|
||||
CreatedAtUnixNano int64 `json:"created_at_unix_nano"`
|
||||
ID string `json:"id"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
}
|
||||
|
||||
type JobConfigEnvelope struct {
|
||||
Image string `json:"image,omitempty"`
|
||||
Commands []string `json:"commands,omitempty"`
|
||||
Environment map[string]string `json:"environment,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
VideoID string `json:"video_id,omitempty"`
|
||||
TimeLimit int64 `json:"time_limit,omitempty"`
|
||||
}
|
||||
13
internal/dto/log.go
Normal file
13
internal/dto/log.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package dto
|
||||
|
||||
type LogEntry struct {
|
||||
JobID string `json:"job_id"`
|
||||
Line string `json:"line"`
|
||||
Progress float64 `json:"progress"`
|
||||
}
|
||||
|
||||
type SystemResource struct {
|
||||
AgentID string `json:"agent_id"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM float64 `json:"ram"`
|
||||
}
|
||||
Reference in New Issue
Block a user