feat(trello): add createBoardCustomField support#781
Conversation
- Add createBoardCustomField method to trelloClient making POST to /customFields
- Method accepts boardId, name, type and returns { id, name, type }
- Add createTrelloCustomField tRPC mutation in integrationsDiscoveryRouter
- Validate boardId (alphanumeric, max 32), name (min 1, max 100), type (enum)
- Add unit tests for client method and tRPC endpoint
- Tests cover success, validation, auth, credentials, and error handling
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Clean, well-structured addition that follows existing patterns precisely. One minor test organization issue worth addressing.
Should Fix
-
tests/unit/api/routers/integrationsDiscovery.test.ts:490 — The new
describe('createTrelloCustomField')block is placed outside the parentdescribe('integrationsDiscoveryRouter')block (which closes at line 486). All other endpoint test suites are nested inside the parent describe. This means thebeforeEachat line 99-102 — which wires up the DB mock chain (mockDbSelect→mockDbFrom→mockDbWhere) — does not run before these tests.The tests currently pass because
mockReturnValuesets a persistent default that survives from earlier tests in the parent describe, but this is order-dependent and fragile. If these tests were ever run in isolation or test ordering changed, the DB-dependent tests (success, NOT_FOUND, API failure) would break.Fix: Move the
describe('createTrelloCustomField', ...)block inside the parentdescribe('integrationsDiscoveryRouter', ...)to match the existing pattern for all other endpoint test suites.
Everything else looks good:
- Client method follows the
createBoardLabelpattern exactly - tRPC endpoint uses the established
withResolvedTrelloCreds+withTrelloCredentials+wrapIntegrationCallchain - Input validation (boardId regex/length, name bounds, type enum) is consistent with existing endpoints
- Return shape
{ id, name, type }matchesgetBoardCustomFields - Test coverage is thorough (auth, validation, success, error wrapping, scope checking)
- CI all green
Move the describe('createTrelloCustomField') block inside the parent
describe('integrationsDiscoveryRouter') so the beforeEach DB mock setup
runs before these tests, matching the pattern of all other endpoint suites.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — Clean, well-structured addition that precisely follows the existing createBoardLabel pattern in both the Trello client and tRPC router. Input validation, credential resolution, and error wrapping all use established conventions. Test coverage is comprehensive (auth, validation, success, error paths). CI is green.
Summary
Add Trello custom field creation support to enable the dashboard wizard to create cost fields on boards.
createBoardCustomField(boardId, name, type)makes POST to/customFieldsendpointcreateTrelloCustomFieldmutation in integrationsDiscoveryRouter with full validation{ id, name, type }matching existing custom field shapeImplementation Details
Trello Client (
src/trello/client.ts)createBoardLabelpatterntrelloFetchto POST to/customFieldswith proper body structuretRPC Router (
src/api/routers/integrationsDiscovery.ts)trelloCredsInputextensionTests
Test Results
✅ All 4,603 unit tests pass
✅ Type checking: zero errors
✅ Linting: zero errors
Acceptance Criteria
✅ createBoardCustomField method in trelloClient
✅ Returns
{ id, name, type }shape✅ createTrelloCustomField tRPC endpoint
✅ Input validation (boardId, name, type)
✅ Comprehensive unit tests
✅ Tests cover auth, success, validation, error handling
PR Link: https://trello.com/c/69b4443615a99b32a56777d2