mirror of
https://github.com/truewhile/MeBox.git
synced 2026-11-12 19:34:24 +08:00
19 lines
440 B
Go
19 lines
440 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/truewhile/MeBox/internal/service"
|
|
)
|
|
|
|
func backgroundTasksHandler(svc *service.Container) gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
if svc == nil || svc.Tasks == nil {
|
|
c.JSON(http.StatusOK, service.TaskSnapshot{Active: []service.BackgroundTask{}, Recent: []service.BackgroundTask{}})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, svc.Tasks.Snapshot())
|
|
}
|
|
}
|