27 lines
632 B
Go
27 lines
632 B
Go
|
|
package job
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"haixun-backend/internal/svc"
|
||
|
|
"haixun-backend/internal/types"
|
||
|
|
)
|
||
|
|
|
||
|
|
type EnableJobScheduleLogic struct {
|
||
|
|
ctx context.Context
|
||
|
|
svcCtx *svc.ServiceContext
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewEnableJobScheduleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EnableJobScheduleLogic {
|
||
|
|
return &EnableJobScheduleLogic{ctx: ctx, svcCtx: svcCtx}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (l *EnableJobScheduleLogic) EnableJobSchedule(req *types.JobScheduleIDPath) (*types.JobScheduleData, error) {
|
||
|
|
schedule, err := l.svcCtx.Job.EnableSchedule(l.ctx, req.ID)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
data := toJobScheduleData(schedule)
|
||
|
|
return &data, nil
|
||
|
|
}
|