feat(MED-131): update analyses sync to medusa store

This commit is contained in:
2025-08-04 11:52:09 +03:00
parent b665678dbb
commit ee60a78335
8 changed files with 460 additions and 186 deletions

View File

@@ -0,0 +1,18 @@
import { format } from 'date-fns';
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
export const getLastCheckedDate = async () => {
const { data: lastChecked } = await getSupabaseServerAdminClient()
.schema('audit')
.from('sync_entries')
.select('created_at')
.eq('status', 'SUCCESS')
.order('created_at')
.limit(1);
const lastEntry = lastChecked?.[0];
const lastCheckedDate = lastEntry
? format(lastEntry.created_at, 'yyyy-MM-dd HH:mm:ss')
: null;
return lastCheckedDate;
}