feat(migrations): Harden task audit tracking and optimize article templates

- Added migration to harden task audit tracking by modifying audit_logs and related tables.
- Introduced operator_id to several tables for better tracking of actions.
- Updated article_templates with new prompt templates for various article types, enhancing content generation.
- Created prompt_rules and schedule_tasks tables to manage content generation rules and scheduling.
- Added foreign key constraints to articles for better data integrity.
This commit is contained in:
2026-04-02 00:31:28 +08:00
parent de30497f59
commit b31d8d0096
101 changed files with 16671 additions and 721 deletions
@@ -31,12 +31,21 @@ func RegisterRoutes(app *bootstrap.App) {
templates.GET("", tplHandler.List)
templates.GET("/:id", tplHandler.Detail)
templates.GET("/:id/schema", tplHandler.Schema)
templates.POST("/:id/drafts", tplHandler.SaveDraft)
templates.POST("/:id/analyze-tasks", tplHandler.CreateAnalyzeTask)
templates.GET("/:id/analyze_task_result", tplHandler.GetAnalyzeTaskResult)
templates.POST("/:id/title-tasks", tplHandler.CreateTitleTask)
templates.GET("/:id/gen_title_task_result", tplHandler.GetTitleTaskResult)
templates.POST("/:id/outline-tasks", tplHandler.CreateOutlineTask)
templates.GET("/:id/gen_outline_task_result", tplHandler.GetOutlineTaskResult)
templates.POST("/:id/generate", tplHandler.Generate)
articles := protected.Group("/tenant/articles")
artHandler := NewArticleHandler(app)
articles.GET("", artHandler.List)
articles.POST("/generate-from-rule", artHandler.GenerateFromRule)
articles.GET("/:id", artHandler.Detail)
articles.PUT("/:id", artHandler.Update)
articles.GET("/:id/stream", artHandler.Stream)
articles.GET("/:id/versions", artHandler.Versions)
articles.DELETE("/:id", artHandler.Delete)
@@ -61,4 +70,30 @@ func RegisterRoutes(app *bootstrap.App) {
brands.POST("/:id/competitors", brandHandler.CreateCompetitor)
brands.PUT("/:id/competitors/:cid", brandHandler.UpdateCompetitor)
brands.DELETE("/:id/competitors/:cid", brandHandler.DeleteCompetitor)
// Prompt Rules
promptRules := protected.Group("/tenant/prompt-rules")
prHandler := NewPromptRuleHandler(app)
promptRules.GET("", prHandler.List)
promptRules.GET("/simple", prHandler.ListSimple)
promptRules.POST("", prHandler.Create)
promptRules.GET("/:id", prHandler.Detail)
promptRules.PUT("/:id", prHandler.Update)
promptRules.DELETE("/:id", prHandler.Delete)
promptRules.PUT("/:id/status", prHandler.ToggleStatus)
// Prompt Rule Groups
promptRules.GET("/groups", prHandler.ListGroups)
promptRules.POST("/groups", prHandler.CreateGroup)
promptRules.PUT("/groups/:gid", prHandler.UpdateGroup)
promptRules.DELETE("/groups/:gid", prHandler.DeleteGroup)
// Schedule Tasks
schedules := protected.Group("/tenant/schedules")
schHandler := NewScheduleTaskHandler(app)
schedules.GET("", schHandler.List)
schedules.POST("", schHandler.Create)
schedules.GET("/:id", schHandler.Detail)
schedules.PUT("/:id", schHandler.Update)
schedules.DELETE("/:id", schHandler.Delete)
schedules.PUT("/:id/status", schHandler.ToggleStatus)
}