File tree Expand file tree Collapse file tree
devcon-api/src/services/ai/open-ai Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,8 +540,17 @@ export const destinoApi = (() => {
540540 const eventExists = ! ! eventRecord
541541
542542 // If exists and updated after last modification, return cached content
543- if ( eventRecord && new Date ( eventRecord . updated_at ) < new Date ( event . LastModifiedDate ) ) {
544- return eventRecord . content
543+ if ( eventRecord ) {
544+ // console.log('record found')
545+ // console.log('updated_at:', eventRecord.updated_at)
546+ // console.log('LastModifiedDate:', event.LastModifiedDate)
547+ // console.log('updated_at date:', new Date(eventRecord.updated_at))
548+ // console.log('LastModifiedDate date:', new Date(event.LastModifiedDate))
549+ // console.log('comparison result:', new Date(eventRecord.updated_at) > new Date(event.LastModifiedDate))
550+
551+ if ( new Date ( eventRecord . updated_at ) > new Date ( event . LastModifiedDate ) ) {
552+ return eventRecord . content
553+ }
545554 }
546555
547556 // Otherwise generate new content
@@ -638,7 +647,7 @@ export const destinoApi = (() => {
638647 }
639648
640649 // Save to Supabase
641- const result = await supabase . from ( 'destino_events' ) . upsert ( upsert )
650+ const result = await supabase . from ( 'destino_events' ) . upsert ( upsert , { defaultToNull : false } )
642651
643652 return result
644653 } ,
You can’t perform that action at this time.
0 commit comments