Skip to content

Custom fields - #54

Open
MangoSwirl wants to merge 1 commit into
mainfrom
custom-fields
Open

Custom fields#54
MangoSwirl wants to merge 1 commit into
mainfrom
custom-fields

Conversation

@MangoSwirl

@MangoSwirl MangoSwirl commented Aug 2, 2026

Copy link
Copy Markdown
Member

Adds the custom fields feature: scouting leads define their own post-match questions (text, number, single-select, multi-select) that scouts answer in Lovat Collection and that surface across the dashboard's analysis, scoped per source team.

What's here (backend)

  • Models: CustomField + CustomFieldAnswer (typed value columns) with Zod/OpenAPI mirrors; SharedPicklist.customFieldWeights. Purely additive (prisma db push).
  • CRUD: lead-only create/update/reorder/archive/unarchive/delete under /v1/manager/customfields, plus a public x-team-code manifest endpoint ({hash, data}) for the collection app's offline cache. Options are append/reorder-only; type is immutable.
  • Submission: optional customFieldAnswers on both scout-report handlers. Lenient — unknown/wrong-team/out-of-options/archived answers are handled gracefully and never reject the report.
  • Analysis: answers flow into raw report data, both CSV exports, category metrics + detail sparklines (number), breakdown distributions (select), and picklist z-scores (number), via a cf_<uuid> key convention.
  • Isolation: per-viewer cache via an augmentResponse hook + viewer-scoped cache keys, so custom data never leaks across teams.
  • Backwards compatible: new clients that don't use custom fields see byte-identical responses; old clients are unaffected.

Testing

Validated end-to-end against a local server restored from a production dump: CRUD via the real dashboard UI, submission via the real collection app, and every analysis surface (raw report, CSV, category avg, sparkline, breakdown distributions, picklist), plus cross-team isolation and backwards-compat. npm run build (tsc) + eslint clean.


Related PRs — this feature spans four repos:

@railway-app

railway-app Bot commented Aug 2, 2026

Copy link
Copy Markdown

🚅 Deployed to the lovat-server-pr-54 environment in lovat

Service Status Web Updated (UTC)
lovat-server ✅ Success (View Logs) Web Aug 2, 2026 at 4:49 am

@railway-app
railway-app Bot temporarily deployed to lovat / lovat-server-pr-54 August 2, 2026 04:41 Destroyed
Let scouting leads define custom post-match questions (text, number,
single-select, multi-select) that scouts answer in Lovat Collection and
that surface across the dashboard's analysis, scoped per source team.

- New CustomField / CustomFieldAnswer models + Zod/OpenAPI mirrors
- Lead-only CRUD plus a public x-team-code manifest endpoint for offline
  caching
- Optional customFieldAnswers on both scout-report submission handlers
  (lenient: unknown/wrong-team/out-of-options answers dropped, report kept)
- Answers flow into raw report data, both CSV exports, category metrics +
  detail sparklines (number), breakdown distributions (select), and
  picklist z-scores (number) via a cf_<uuid> key convention
- Per-viewer cache isolation so custom data never leaks across teams
- Fully additive/backwards-compatible

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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