refactor: remove JobTemplate production code
Remove all JobTemplate model, store, handler, migrations, and wiring. Replaced by Application Definition system. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -25,16 +25,17 @@ type ClusterHandler interface {
|
||||
GetDiag(c *gin.Context)
|
||||
}
|
||||
|
||||
type TemplateHandler interface {
|
||||
ListTemplates(c *gin.Context)
|
||||
CreateTemplate(c *gin.Context)
|
||||
GetTemplate(c *gin.Context)
|
||||
UpdateTemplate(c *gin.Context)
|
||||
DeleteTemplate(c *gin.Context)
|
||||
type ApplicationHandler interface {
|
||||
ListApplications(c *gin.Context)
|
||||
CreateApplication(c *gin.Context)
|
||||
GetApplication(c *gin.Context)
|
||||
UpdateApplication(c *gin.Context)
|
||||
DeleteApplication(c *gin.Context)
|
||||
SubmitApplication(c *gin.Context)
|
||||
}
|
||||
|
||||
// NewRouter creates a Gin engine with all API v1 routes registered with real handlers.
|
||||
func NewRouter(jobH JobHandler, clusterH ClusterHandler, templateH TemplateHandler, logger *zap.Logger) *gin.Engine {
|
||||
func NewRouter(jobH JobHandler, clusterH ClusterHandler, appH ApplicationHandler, logger *zap.Logger) *gin.Engine {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
r := gin.New()
|
||||
r.Use(gin.Recovery())
|
||||
@@ -59,12 +60,13 @@ func NewRouter(jobH JobHandler, clusterH ClusterHandler, templateH TemplateHandl
|
||||
|
||||
v1.GET("/diag", clusterH.GetDiag)
|
||||
|
||||
templates := v1.Group("/templates")
|
||||
templates.GET("", templateH.ListTemplates)
|
||||
templates.POST("", templateH.CreateTemplate)
|
||||
templates.GET("/:id", templateH.GetTemplate)
|
||||
templates.PUT("/:id", templateH.UpdateTemplate)
|
||||
templates.DELETE("/:id", templateH.DeleteTemplate)
|
||||
apps := v1.Group("/applications")
|
||||
apps.GET("", appH.ListApplications)
|
||||
apps.POST("", appH.CreateApplication)
|
||||
apps.GET("/:id", appH.GetApplication)
|
||||
apps.PUT("/:id", appH.UpdateApplication)
|
||||
apps.DELETE("/:id", appH.DeleteApplication)
|
||||
apps.POST("/:id/submit", appH.SubmitApplication)
|
||||
|
||||
return r
|
||||
}
|
||||
@@ -95,12 +97,13 @@ func registerPlaceholderRoutes(v1 *gin.RouterGroup) {
|
||||
|
||||
v1.GET("/diag", notImplemented)
|
||||
|
||||
templates := v1.Group("/templates")
|
||||
templates.GET("", notImplemented)
|
||||
templates.POST("", notImplemented)
|
||||
templates.GET("/:id", notImplemented)
|
||||
templates.PUT("/:id", notImplemented)
|
||||
templates.DELETE("/:id", notImplemented)
|
||||
apps := v1.Group("/applications")
|
||||
apps.GET("", notImplemented)
|
||||
apps.POST("", notImplemented)
|
||||
apps.GET("/:id", notImplemented)
|
||||
apps.PUT("/:id", notImplemented)
|
||||
apps.DELETE("/:id", notImplemented)
|
||||
apps.POST("/:id/submit", notImplemented)
|
||||
}
|
||||
|
||||
func notImplemented(c *gin.Context) {
|
||||
|
||||
@@ -27,11 +27,12 @@ func TestAllRoutesRegistered(t *testing.T) {
|
||||
{"GET", "/api/v1/partitions"},
|
||||
{"GET", "/api/v1/partitions/:name"},
|
||||
{"GET", "/api/v1/diag"},
|
||||
{"GET", "/api/v1/templates"},
|
||||
{"POST", "/api/v1/templates"},
|
||||
{"GET", "/api/v1/templates/:id"},
|
||||
{"PUT", "/api/v1/templates/:id"},
|
||||
{"DELETE", "/api/v1/templates/:id"},
|
||||
{"GET", "/api/v1/applications"},
|
||||
{"POST", "/api/v1/applications"},
|
||||
{"GET", "/api/v1/applications/:id"},
|
||||
{"PUT", "/api/v1/applications/:id"},
|
||||
{"DELETE", "/api/v1/applications/:id"},
|
||||
{"POST", "/api/v1/applications/:id/submit"},
|
||||
}
|
||||
|
||||
routeMap := map[string]bool{}
|
||||
@@ -74,7 +75,7 @@ func TestRegisteredPathReturns501(t *testing.T) {
|
||||
{"GET", "/api/v1/nodes"},
|
||||
{"GET", "/api/v1/partitions"},
|
||||
{"GET", "/api/v1/diag"},
|
||||
{"GET", "/api/v1/templates"},
|
||||
{"GET", "/api/v1/applications"},
|
||||
}
|
||||
|
||||
for _, ep := range endpoints {
|
||||
|
||||
Reference in New Issue
Block a user