github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/apis/cronjob/get.go (about) 1 package cronjob 2 3 import ( 4 "context" 5 6 "github.com/machinefi/w3bstream/cmd/srv-applet-mgr/apis/middleware" 7 "github.com/machinefi/w3bstream/pkg/depends/kit/httptransport/httpx" 8 "github.com/machinefi/w3bstream/pkg/modules/cronjob" 9 "github.com/machinefi/w3bstream/pkg/types" 10 ) 11 12 type ListCronJob struct { 13 httpx.MethodGet 14 ProjectID types.SFID `in:"path" name:"projectID"` 15 cronjob.ListReq 16 } 17 18 func (r *ListCronJob) Path() string { return "/:projectID" } 19 20 func (r *ListCronJob) Output(ctx context.Context) (interface{}, error) { 21 ctx, err := middleware.MustCurrentAccountFromContext(ctx). 22 WithProjectContextBySFID(ctx, r.ProjectID) 23 if err != nil { 24 return nil, err 25 } 26 r.ListReq.ProjectID = types.MustProjectFromContext(ctx).ProjectID 27 return cronjob.List(ctx, &r.ListReq) 28 }