Skip to content

Commit

Permalink
[gh-#975] add nango_metadata property to all results
Browse files Browse the repository at this point in the history
  • Loading branch information
khaliqgant committed Sep 13, 2023
1 parent 3ceab29 commit 3b55910
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/shared/lib/services/sync/data/records.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,19 @@ export async function getDataRecords(
'json as record'
);
} else {
result = (await query.pluck('json')) as Pick<SyncDataRecord, 'json'>[];
result = await query.select(
db.knex.raw(`
jsonb_set(
json::jsonb,
'{_nango_metadata}',
json_build_object(
'created_at', created_at,
'updated_at', updated_at,
'deleted_at', external_deleted_at
)::jsonb
) as record
`)
);
}

return { success: true, error: null, response: result };
Expand Down

0 comments on commit 3b55910

Please # to comment.