// Package module defines the small contracts shared by application modules. // A module contributes its own schema, seed data, admin surface and runtime // hooks without depending on the built-in system implementation. package module import ( "github.com/gin-gonic/gin" "kra/pkg/database/migration" ) type Menu struct { Name, Path, ParentName, Component, Title, Icon string Sort int } type API struct { Path, Method, Group, Description string } type Surface struct { Menus []Menu APIs []API } type TimedTask struct { Name, Description, Spec, MethodName string WithSeconds, Enabled bool } type Definition struct { Name string Migrations []migration.Step Surface Surface TimedTasks []TimedTask } type Catalog struct { Definitions []Definition } func (c Catalog) MigrationSteps() []migration.Step { var steps []migration.Step for _, item := range c.Definitions { steps = append(steps, item.Migrations...) } return steps } func (c Catalog) DefaultTimedTasks() []TimedTask { var tasks []TimedTask for _, item := range c.Definitions { tasks = append(tasks, item.TimedTasks...) } return tasks } type RouteRegistrar interface { RegisterRoutes(public, private *gin.RouterGroup, engine *gin.Engine) }