@@ -121,7 +121,7 @@ export async function GET(req: NextRequest) {
121121 . limit ( 1 )
122122
123123 const headers = new Headers ( )
124- headers . set ( 'Cache-Control' , 'max-age=30 ' )
124+ headers . set ( 'Cache-Control' , 'no-store, max-age=0 ' )
125125
126126 if ( schedule . length === 0 ) {
127127 return NextResponse . json ( { schedule : null } , { headers } )
@@ -301,9 +301,13 @@ export async function POST(req: NextRequest) {
301301 time : scheduleTime || 'not specified' ,
302302 } )
303303
304- cronExpression = generateCronExpression ( defaultScheduleType , scheduleValues )
304+ const sanitizedScheduleValues =
305+ defaultScheduleType !== 'custom'
306+ ? { ...scheduleValues , cronExpression : null }
307+ : scheduleValues
308+
309+ cronExpression = generateCronExpression ( defaultScheduleType , sanitizedScheduleValues )
305310
306- // Always validate the generated cron expression
307311 if ( cronExpression ) {
308312 const validation = validateCronExpression ( cronExpression , timezone )
309313 if ( ! validation . isValid ) {
@@ -318,7 +322,7 @@ export async function POST(req: NextRequest) {
318322 }
319323 }
320324
321- nextRunAt = calculateNextRunTime ( defaultScheduleType , scheduleValues )
325+ nextRunAt = calculateNextRunTime ( defaultScheduleType , sanitizedScheduleValues )
322326
323327 logger . debug (
324328 `[${ requestId } ] Generated cron: ${ cronExpression } , next run at: ${ nextRunAt . toISOString ( ) } `
0 commit comments