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:
dailz
2026-04-13 17:07:46 +08:00
parent 62e458cb7a
commit dd8d226e78
11 changed files with 35 additions and 948 deletions

View File

@@ -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) {