Repository navigation
feat(api): Prospector two-way sync, Phase A (doNotContact, statusChangedAt, serverTime) - #94
Merged
Merged
Conversation
GET /api/leads?updatedSince=<iso> returns only the leads changed since that instant, which lets an integration notice a lead the user marked as do-not-contact and stop its sequence. Ordering flips to updatedAt ascending by default so a poller can page with limit + page and keep the highest updatedAt as its next cursor. An invalid value answers 400 naming updatedSince.
…tus changes
Phase A of the Prospector two-way sync: the catalog is an array of
{ value, label, doNotContact }, stages carry is_do_not_contact,
updatedSince filters on status_changed_at and GET /api/leads returns
serverTime as the next cursor. Unknown statuses are still accepted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase A of the Prospector two-way sync. Unknown statuses are still accepted; rejection (Phase B) ships separately once the Prospector validates against the catalog.
GET /api/leads/statusesreturns an array of{ value, label, doNotContact }built from the user's pipeline stages (deduplicated by name).pipeline_stages.is_do_not_contact, settable through the stage create/update endpoints. Existing stages named Perdido, Descartado, Rebotó or No contactar are flagged by the migration.leads.status_changed_at, moved by the trigger only whenstatuschanges, so a contact-data push does not look like a CRM change.GET /api/leads?updatedSince=filters onstatus_changed_at(ascending by default) and the response includesserverTimeto use as the next cursor.7fd98a2(updatedSincefilter), which was committed after feat(api): finish the integration contract (status catalog + updatedSince) #93 merged and never reachedmain.Breaking change
GET /api/leads/statuseschanges from{ statuses, names, default }to a bare array. The Prospector does not consume it yet.Deploy
supabase/migrations/20261114000000_status_catalog_and_status_changed_at.sql(backfillsstatus_changed_at, replacesfn_sync_lead_status_with_stage). Not yet run against a database.Checks
tsc --noEmitcleanjest: 117 suites, 869 tests pass🤖 Generated with Claude Code