Skip to content

feat: add is_extended_promotional column to all component tables#137

Open
huangyebiaoke wants to merge 3 commits intotscircuit:mainfrom
huangyebiaoke:feat/is-extended-promotional
Open

feat: add is_extended_promotional column to all component tables#137
huangyebiaoke wants to merge 3 commits intotscircuit:mainfrom
huangyebiaoke:feat/is-extended-promotional

Conversation

@huangyebiaoke
Copy link

Summary

/claim #92

Adds extended_promotional field from the JLCPCB data source and exposes it as is_extended_promotional across 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

File Change
lib/db/generated/kysely.ts Added extended_promotional to Component and VComponent interfaces
lib/db/derivedtables/component-base.ts Added is_extended_promotional: boolean to base type
37 derived table files Added column spec + Boolean(c.extended_promotional) mapping
lib/db/optimizations/component-extended-promotional-index.ts New index for query performance
scripts/setup-db-optimizations.ts Registered new optimization
routes/components/list.tsx Added query param filter + UI checkbox
routes/api/search.tsx Added is_extended_promotional filter + response field
cf-proxy/src/handlers/index.ts Added field to resistor/capacitor TABLE_CONFIGS

Implementation Notes

  • Follows the exact same pattern as is_basic and is_preferred columns
  • Boolean(c.extended_promotional) safely handles null/0/1 from SQLite
  • DB index added for fast filtering
  • ldo table inherits from voltage_regulator so no separate changes needed

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant