From 5dc1bb5b49db38069c07d44eb91b71970333e547 Mon Sep 17 00:00:00 2001 From: Nathan <70660308+NotARoomba@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:15:39 -0500 Subject: [PATCH] Update airtable-sync.ts --- backend/src/lib/airtable-sync.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/lib/airtable-sync.ts b/backend/src/lib/airtable-sync.ts index 089f18a..c378f3b 100644 --- a/backend/src/lib/airtable-sync.ts +++ b/backend/src/lib/airtable-sync.ts @@ -133,15 +133,20 @@ async function syncProjectsToAirtable(): Promise { // Fetch existing records from Airtable to find which ones to update vs create const existingRecords: Map = new Map() // github_url -> airtable record id + const approvedRecords: Set = new Set() // github_urls that are already approved in Airtable await new Promise((resolve, reject) => { table.select({ - fields: ['Code URL'] + fields: ['Code URL', 'Review Status'] }).eachPage( (records, fetchNextPage) => { for (const record of records) { const githubUrl = record.get('Code URL') if (githubUrl) { existingRecords.set(String(githubUrl), record.id) + const reviewStatus = record.get('Review Status') + if (reviewStatus === 'Approved') { + approvedRecords.add(String(githubUrl)) + } } } fetchNextPage() @@ -167,6 +172,9 @@ async function syncProjectsToAirtable(): Promise { if (!project.githubUrl) continue // skip projects without a GitHub URL if (!project.image) continue // screenshot must exist + // Skip projects already approved in Airtable — don't overwrite them + if (approvedRecords.has(project.githubUrl)) continue + // Check for duplicate Code URL among shipped projects if (seenCodeUrls.has(project.githubUrl)) { console.log(`[AIRTABLE-SYNC] Duplicate Code URL detected for project ${project.id}: ${project.githubUrl}, reverting to waiting_for_review`)