feat: add is_extended_promotional column to all component tables#137
Open
huangyebiaoke wants to merge 3 commits intotscircuit:mainfrom
Open
feat: add is_extended_promotional column to all component tables#137huangyebiaoke wants to merge 3 commits intotscircuit:mainfrom
huangyebiaoke wants to merge 3 commits intotscircuit:mainfrom
Conversation
…ircuit#92) Add `extended_promotional` field to the components database and expose it as `is_extended_promotional` across all derived tables and API endpoints. Extended promotional parts are components that act as basic parts for a limited time period, offering reduced or no setup fees temporarily. ## Changes - **Database schema** (`lib/db/generated/kysely.ts`): Added `extended_promotional` to `Component` and `VComponent` interfaces - **Base types** (`lib/db/derivedtables/component-base.ts`): Added `is_extended_promotional: boolean` to BaseComponent - **37 derived tables**: Added `is_extended_promotional` column spec and `Boolean(c.extended_promotional)` mapping to all component tables - **DB optimization** (`lib/db/optimizations/component-extended-promotional-index.ts`): Added index on `components.extended_promotional` for query performance - **Setup script** (`scripts/setup-db-optimizations.ts`): Registered new optimization - **Components list route** (`routes/components/list.tsx`): Added query param filter and UI checkbox - **Search API** (`routes/api/search.tsx`): Added `is_extended_promotional` filter support and response field - **CF proxy** (`cf-proxy/src/handlers/index.ts`): Added field to resistor and capacitor TABLE_CONFIGS Fixes tscircuit#92
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
/claim #92
Adds
extended_promotionalfield from the JLCPCB data source and exposes it asis_extended_promotionalacross all derived component tables, APIs, and the search UI.Extended promotional parts are components that temporarily act as basic parts (reduced/no setup fees for a limited time).
Changes
lib/db/generated/kysely.tsextended_promotionaltoComponentandVComponentinterfaceslib/db/derivedtables/component-base.tsis_extended_promotional: booleanto base typeBoolean(c.extended_promotional)mappinglib/db/optimizations/component-extended-promotional-index.tsscripts/setup-db-optimizations.tsroutes/components/list.tsxroutes/api/search.tsxis_extended_promotionalfilter + response fieldcf-proxy/src/handlers/index.tsImplementation Notes
is_basicandis_preferredcolumnsBoolean(c.extended_promotional)safely handles null/0/1 from SQLiteldotable inherits fromvoltage_regulatorso no separate changes needed