优化
This commit is contained in:
@@ -44,9 +44,6 @@ func (s *TaskService) Delete(ctx context.Context, id uint) error {
|
||||
func (s *TaskService) Toggle(ctx context.Context, id uint, enabled bool) error {
|
||||
return s.uc.ToggleTask(ctx, id, enabled)
|
||||
}
|
||||
func (s *TaskService) Task(ctx context.Context, id uint) (*biz.TimedTask, error) {
|
||||
return s.uc.FindTask(ctx, id)
|
||||
}
|
||||
func taskDTO(v *biz.TimedTask, next *time.Time) map[string]any {
|
||||
return map[string]any{"ID": v.ID, "CreatedAt": v.CreatedAt, "UpdatedAt": v.UpdatedAt, "DeletedAt": nil, "name": v.Name, "description": v.Description, "spec": v.Spec, "withSeconds": v.WithSeconds, "executorType": v.ExecutorType, "methodName": v.MethodName, "params": json.RawMessage(v.Params), "httpUrl": v.HTTPURL, "httpMethod": v.HTTPMethod, "httpHeader": json.RawMessage(v.HTTPHeader), "httpBody": v.HTTPBody, "httpAllowPrivate": v.HTTPAllowPrivate, "enabled": v.Enabled, "nextRunAt": next}
|
||||
}
|
||||
@@ -67,12 +64,6 @@ func (s *TaskService) Tasks(ctx context.Context, page, size int, q *biz.TimedTas
|
||||
return out, total, nil
|
||||
}
|
||||
|
||||
// ScheduledTasks is the typed internal contract used by the scheduler and
|
||||
// deliberately bypasses transport response maps.
|
||||
func (s *TaskService) ScheduledTasks(ctx context.Context) ([]*biz.TimedTask, error) {
|
||||
items, _, err := s.uc.ListTasks(ctx, 0, 0, nil)
|
||||
return items, err
|
||||
}
|
||||
func (s *TaskService) Logs(ctx context.Context, page, size int, taskID uint, status string) ([]map[string]any, int64, error) {
|
||||
items, total, err := s.uc.ListTaskLogs(ctx, page, size, taskID, status)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user