Skip to content

feat: add Create Selection tool for building MP selections#53

Open
wantmoore wants to merge 7 commits intoMinistryPlatform-Community:mainfrom
wantmoore:main
Open

feat: add Create Selection tool for building MP selections#53
wantmoore wants to merge 7 commits intoMinistryPlatform-Community:mainfrom
wantmoore:main

Conversation

@wantmoore
Copy link
Contributor

Summary

  • Adds a new Create Selection mini-app that lets users build Ministry Platform selections from filtered record sets using stored procedures
  • Includes SelectionService with full test coverage, DTO layer, and server actions
  • Adds sidebar navigation link for the new tool
  • Includes SQL install scripts for the required stored procedures (api_Custom_CreateSelection, api_custom_GetPages)
  • Documents stored procedure installation steps in README

New Files

  • src/components/create-mp-selection/ — feature component
  • src/app/(web)/create-mp-selection/ — page route and actions
  • src/services/selectionService.ts — service layer with tests
  • src/lib/dto/selections.ts — selection DTOs
  • scripts/ — SQL stored procedure install scripts

Prerequisites

The following stored procedures must be installed in the Ministry Platform database before using this feature:

  • api_Custom_CreateSelection
  • api_custom_GetPages

Install scripts are provided in scripts/ and are self-contained (create procedure, register in dp_API_Procedures, grant permissions).

Test Plan

  • SelectionService unit tests pass (npm run test:run)
  • Build succeeds (npm run build)
  • Create Selection page loads and displays table/view picker
  • Selection creation works end-to-end with valid MP credentials

🤖 Generated with Claude Code

wantmoore and others added 7 commits February 27, 2026 15:26
… filtered record sets

Adds a reusable component that POSTs filtered record IDs to MinistryPlatform
as a permanent named selection (dp_Selections + dp_Selected_Records) and
returns a deep-link URL for opening the selection directly in the MP web app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a reusable dialog component that saves record IDs as named MP
Selections via custom stored procedures, replacing direct dp_* table
access which is blocked by API permissions.

Key changes:
- CreateMpSelection component with page picker, auto-timestamped names,
  copy-to-clipboard, and deep-link to MP
- SelectionService using api_custom_CreateSelection and
  api_custom_GetPages stored procedures
- Demo page at /create-mp-selection with contact list and page mapping
- HttpClient POST error handling now includes response body
- New env vars: MINISTRY_PLATFORM_DOMAIN_ID, updated
  NEXT_PUBLIC_MINISTRY_PLATFORM_URL docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the new CreateMpSelection component, its usage, required
stored procedures (api_custom_CreateSelection, api_custom_GetPages),
environment variables, and demo page in the project README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Create Selection to sidebar navigation, include stored procedure
SQL install scripts, and document installation steps in README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update selectionService tests to mock executeProcedureWithBody instead
  of createTableRecords (matching the stored procedure implementation)
- Add missing text() mock to http-client error response test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/services/selectionService.ts 78.12% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

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