Skip to content

refactor(customer): consolidate bulkCreate onto shared factory#92

Merged
CryptoJones merged 1 commit into
masterfrom
refactor/customer-bulkcreate-consolidate
May 18, 2026
Merged

refactor(customer): consolidate bulkCreate onto shared factory#92
CryptoJones merged 1 commit into
masterfrom
refactor/customer-bulkcreate-consolidate

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Follow-up to #81 (P3-H). Customer's hand-rolled bulkCreate predated the makeBulkCreate factory; identical semantics, ~85 lines of duplication.

Summary

  • Customer/bulkCreate now calls the shared factory in app/controllers/_bulk-helpers.js.
  • Behavior on the wire is unchanged — tests/api/customer-bulk.test.js continues to pass.
  • Drops 90 lines, adds 16.

Test plan

  • 472 pass / 4 skip. Lint clean.

This code proudly made in Nebraska. GO BIG RED! 🌽 https://xkcd.com/2347/

The Customer controller's bulkCreate predates the
`makeBulkCreate` factory in `app/controllers/_bulk-helpers.js`
(introduced in P3-H for the other 5 direct-compId entities). The
two implementations had identical semantics, just duplicated code.
This swaps Customer's hand-rolled handler for a call to the
factory, dropping ~85 lines.

The factory accepts:
- Model: Customer
- modelKey: 'Customer' (for log lines)
- compIdField: 'custCompId'
- allowedFields: the same 11-column whitelist
- archField: 'custArch'
- bodyKey / createdKey: 'customers' (request and response shape
  preserved exactly)

Behavior on the wire is unchanged. The same 11 test cases in
tests/api/customer-bulk.test.js continue to pass.

Tests: 472 pass / 4 skip. Lint clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 7fe7b8d into master May 18, 2026
3 checks passed
@CryptoJones CryptoJones deleted the refactor/customer-bulkcreate-consolidate branch May 18, 2026 05:38
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