Skip to content

feat(FM-IC-CFG-001): user-defined custom data fields for funders & opportunities - #198

Open
SpikeyCoder wants to merge 3 commits into
mainfrom
feature/FM-IC-CFG-001-custom-fields
Open

feat(FM-IC-CFG-001): user-defined custom data fields for funders & opportunities#198
SpikeyCoder wants to merge 3 commits into
mainfrom
feature/FM-IC-CFG-001-custom-fields

Conversation

@SpikeyCoder

Copy link
Copy Markdown
Owner

FM-IC-CFG-001 — Add custom data fields to funders/opportunities

Closes the Instrumentl competitive gap flagged FAIL in the 2026-06-14 daily usability audit:

"Still no custom-field schema. Funders + tracked_grants use fixed columns."

Users can now define their own data fields and attach values to the funders and opportunities they track — beyond the fixed columns + free-text notes.

Backend

  • Migration 20260614130000_cfg001_custom_fields.sql
    • custom_field_definitions table (user-scoped RLS; entity = funder | grant; field_type = text/number/date/select/checkbox/url; options jsonb for dropdowns).
    • custom_fields jsonb value column added to both saved_funders and tracked_grants.
  • tracked-grants edge function — persists custom_fields on POST and PUT.

Frontend

  • types.tsCustomFieldDefinition / CustomFieldValue; customFields on SavedFunderEntry and custom_fields on TrackedGrant.
  • AuthContext — reads/writes saved_funders.custom_fields.
  • lib/customFields.ts — fetch/slugify/coerce/format helpers.
  • CustomFieldsEditor — inline value inputs rendered on SavedFunders pipeline cards.
  • CustomFieldsSettings — new Custom Fields tab in Account Settings to define fields for Funders and Opportunities.

Design decisions (autonomous run)

  • Values stored as flat jsonb keyed by field_key (tiny cardinality, single-row reads, mirrors existing funder_data snapshot pattern) rather than a separate values table.
  • Definitions are user-scoped (matches FunderMatch SMB ICP); per-org sharing left as a follow-up.
  • All access guarded by RLS consistent with saved_funders / tracked_grants.

Verification

  • npm run build (tsc -b && vite build) passes with no type errors.

Generated by the fundermatch-feature-builder scheduled task.

…nities

Adds a per-user custom-field schema so users can attach their own data
fields (e.g. Program Officer, Internal Priority, Board Champion) to saved
funders and tracked opportunities — closing the Instrumentl gap flagged in
the 2026-06-14 usability audit ('no custom-field schema; funders +
tracked_grants use fixed columns').

Backend:
- Migration 20260614130000_cfg001_custom_fields.sql:
  - new custom_field_definitions table (user-scoped RLS, entity =
    funder|grant, field_type text/number/date/select/checkbox/url)
  - custom_fields jsonb column on saved_funders and tracked_grants
- tracked-grants edge function: persist custom_fields on POST/PUT

Frontend:
- types: CustomFieldDefinition / CustomFieldValue + customFields on
  SavedFunderEntry and TrackedGrant
- AuthContext: read/write saved_funders.custom_fields
- lib/customFields.ts helpers
- CustomFieldsEditor: inline value inputs on SavedFunders pipeline cards
- CustomFieldsSettings: new 'Custom Fields' tab in Account Settings to
  define fields for funders and opportunities

npm run build passes (tsc -b && vite build).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploying funder-finder with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5fc32a0
Status: ✅  Deploy successful!
Preview URL: https://299724c9.funder-finder.pages.dev
Branch Preview URL: https://feature-fm-ic-cfg-001-custom-va92.funder-finder.pages.dev

View logs

Bring in PR #192's unique contributions:
- ProjectWorkspace.tsx: custom field state, handlers (persistCustomFields,
  handleAddCustomField, handleRemoveCustomField, handleCustomFieldValueChange),
  and 'Custom Fields' UI section in grant detail drawer
- tracked-grants/index.ts: add sanitiseCustomFields() guard that validates,
  trims, and caps custom fields (max 50 fields, key max 80 chars, value max
  2000 chars) — replaces the simpler typeof check from #198

Closes #192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant