@@ -3,12 +3,8 @@ import { copilotChats, workflowSchedule } from '@sim/db/schema'
33import { createLogger } from '@sim/logger'
44import { and , eq } from 'drizzle-orm'
55import { v4 as uuidv4 } from 'uuid'
6- import type { ToolCallResult } from '@/lib/copilot/orchestrator/types'
7- import type { ExecutionContext } from '@/lib/copilot/orchestrator/types'
8- import {
9- parseCronToHumanReadable ,
10- validateCronExpression ,
11- } from '@/lib/workflows/schedules/utils'
6+ import type { ExecutionContext , ToolCallResult } from '@/lib/copilot/orchestrator/types'
7+ import { parseCronToHumanReadable , validateCronExpression } from '@/lib/workflows/schedules/utils'
128
139const logger = createLogger ( 'JobTools' )
1410
@@ -98,7 +94,7 @@ export async function executeCreateJob(
9894 }
9995
10096 const parsed = new Date ( timeStr )
101- if ( isNaN ( parsed . getTime ( ) ) ) {
97+ if ( Number . isNaN ( parsed . getTime ( ) ) ) {
10298 return { success : false , error : `Invalid time value: ${ time } ` }
10399 }
104100
@@ -384,10 +380,7 @@ export async function executeManageJob(
384380 updates . maxRuns = args . maxRuns
385381 }
386382
387- await db
388- . update ( workflowSchedule )
389- . set ( updates )
390- . where ( eq ( workflowSchedule . id , args . jobId ) )
383+ await db . update ( workflowSchedule ) . set ( updates ) . where ( eq ( workflowSchedule . id , args . jobId ) )
391384
392385 logger . info ( 'Job updated' , { jobId : args . jobId , fields : Object . keys ( updates ) } )
393386
@@ -429,9 +422,7 @@ export async function executeManageJob(
429422 return { success : false , error : `Job not found: ${ args . jobId } ` }
430423 }
431424
432- await db
433- . delete ( workflowSchedule )
434- . where ( eq ( workflowSchedule . id , args . jobId ) )
425+ await db . delete ( workflowSchedule ) . where ( eq ( workflowSchedule . id , args . jobId ) )
435426
436427 logger . info ( 'Job deleted' , { jobId : args . jobId } )
437428
@@ -473,9 +464,7 @@ export async function executeCompleteJob(
473464 sourceWorkspaceId : workflowSchedule . sourceWorkspaceId ,
474465 } )
475466 . from ( workflowSchedule )
476- . where (
477- and ( eq ( workflowSchedule . id , jobId ) , eq ( workflowSchedule . sourceType , 'job' ) )
478- )
467+ . where ( and ( eq ( workflowSchedule . id , jobId ) , eq ( workflowSchedule . sourceType , 'job' ) ) )
479468 . limit ( 1 )
480469
481470 if ( ! job ) {
0 commit comments