master
Evan Chen 2021-12-17 17:27:56 +08:00
parent 2af8820697
commit cadba21a9d
2 changed files with 4 additions and 4 deletions

View File

@ -62,5 +62,8 @@ func (srv Service) Load() error {
ctlAPI.GET("tasks", auth.ACAdmin(), func(c *gin.Context) { ctlAPI.GET("tasks", auth.ACAdmin(), func(c *gin.Context) {
server.OK(c, task.GetProfile()) server.OK(c, task.GetProfile())
}) })
ctlAPI.GET("task", auth.ACAdmin(), func(c *gin.Context) {
server.OK(c, task.GetTasks())
})
return nil return nil
} }

View File

@ -31,14 +31,11 @@ type Report struct {
} }
type Profile struct { type Profile struct {
Tasks map[string]*Task
Scheduled []*Report `json:"scheduled"` Scheduled []*Report `json:"scheduled"`
} }
func GetProfile() *Profile { func GetProfile() *Profile {
p := &Profile{ p := &Profile{}
Tasks: GetTasks(),
}
entries := c.Entries() entries := c.Entries()
for i := 0; i < len(entries); i++ { for i := 0; i < len(entries); i++ {
t, ok := entries[i].Job.(*_task) t, ok := entries[i].Job.(*_task)