feat: add is_extended_promotional column to components and search API#143
Open
Nicolas-Rozas wants to merge 4 commits intotscircuit:mainfrom
Open
feat: add is_extended_promotional column to components and search API#143Nicolas-Rozas wants to merge 4 commits intotscircuit:mainfrom
Nicolas-Rozas wants to merge 4 commits intotscircuit:mainfrom
Conversation
- Add is_extended_promotional to queryParams in /components/list and /api/search - Compute is_extended_promotional as CASE WHEN preferred=1 AND basic=0 THEN 1 ELSE 0 END - Add filter support: ?is_extended_promotional=true filters to extended promotional parts - Include is_extended_promotional in API response for both endpoints - Add Extended Promotional checkbox to /components/list UI - Update BaseComponent interface to include is_extended_promotional - Add tests for is_extended_promotional field presence and filtering
added 3 commits
March 10, 2026 21:31
…romotional implementation
…errors in derived tables
🎬 UI DemoDemonstration of the **is_extend bounty-92-ui-demo.mp4ed_promotional** filter feature: ![is_extended_promotional UI Demo] What the video shows:
The implementation adds:
/claim #92 |
Author
|
@seveibar Just set up GitHub Sponsors and connected Stripe — waiting for profile approval. All CI checks are passing and no conflicts. Could you review and merge when you get a chance? Thanks! |
songshanhua-eng
added a commit
to songshanhua-eng/jlcsearch
that referenced
this pull request
Mar 13, 2026
… tests - Restore original search.test.ts and list.test.ts (no splitting) - Restore original get-test-server.ts (no complex db validation) - Restore original preload.ts (no complex db checks) - Add is_extended_promotional field tests at end of existing test files - Follow PR tscircuit#143 pattern for test structure This simplifies the test setup and matches the pattern used in PR tscircuit#143 which successfully passed all CI tests.
songshanhua-eng
added a commit
to songshanhua-eng/jlcsearch
that referenced
this pull request
Mar 13, 2026
- Change from .where((eb) => eb(...).and(...)) to .where().where() - Match PR tscircuit#143 implementation that passed all tests - Fix database query that was causing test failures This fixes the incorrect Kysely query syntax that was causing 92/94 tests to pass but 2 tests to fail.
songshanhua-eng
added a commit
to songshanhua-eng/jlcsearch
that referenced
this pull request
Mar 13, 2026
…void breaking component category tests - Keep is_extended_promotional field in response (for UI display) - Remove filtering logic (only available in /api/search endpoint) - This matches PR tscircuit#143 pattern that passed all tests - Component category list endpoints (resistors/list, etc.) inherit from this, so filtering would break their existing tests
songshanhua-eng
added a commit
to songshanhua-eng/jlcsearch
that referenced
this pull request
Mar 13, 2026
- This test was failing because filtering is only available in /api/search - Keep the field test (is_extended_promotional field exists in response) - Remove the filter test (filtering logic removed from /components/list) - This matches PR tscircuit#143 pattern that passed all tests
songshanhua-eng
added a commit
to songshanhua-eng/jlcsearch
that referenced
this pull request
Mar 13, 2026
…scircuit#143 pattern - Remove is_extended_promotional field from /components/list response - Remove is_extended_promotional query parameter - Remove related tests - Keep is_extended_promotional only in /api/search endpoint - This matches PR tscircuit#143 that passed all tests The field was breaking component category list tests (resistors/list, etc.) because those endpoints inherit from /components/list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
is_extended_promotionalboolean field to the components list and search API endpoints, as requested in #92.Extended promotional parts are those that temporarily act as basic parts — identified as
preferred = 1 AND basic = 0.Changes
routes/components/list.tsxis_extended_promotionaltoqueryParamsschemaCASE WHEN preferred = 1 AND basic = 0 THEN 1 ELSE 0 ENDin SELECTpreferredcolumn to SELECT (needed for the computed field)?is_extended_promotional=truenarrows results to extended promotional parts onlyis_extended_promotionalboolean to the component response maproutes/api/search.tsxis_extended_promotionaltoqueryParamsschema?is_extended_promotional=truefilters bypreferred=1 AND basic=0is_extended_promotionalto the component response map (computed frompreferred && !basic)lib/db/derivedtables/component-base.tsis_extended_promotional: booleantoBaseComponentinterfacetests/routes/api/search.test.tsis_extended_promotionalfield is present and is a booleanis_preferred=true, is_basic=falsecomponentstests/routes/components/list.test.tsis_extended_promotionalfield is present and is a boolean/claim #92