[feat] implemented product variants

This commit is contained in:
2026-02-23 19:05:55 -05:00
parent 30433696e5
commit 240e4ce88b
6 changed files with 52 additions and 15 deletions

View File

@@ -23,6 +23,7 @@ async function createCollection(client: Client) {
name: 'cards',
fields: [
{ name: 'productId', type: 'int32' },
{ name: 'variant', type: 'string' },
{ name: 'productName', type: 'string' },
{ name: 'productLineName', type: 'string', facet: true },
{ name: 'rarityName', type: 'string', facet: true },
@@ -33,7 +34,7 @@ async function createCollection(client: Client) {
{ name: 'Artist', type: 'string' },
{ name: 'sealed', type: 'bool' },
],
default_sorting_field: 'productId',
//default_sorting_field: 'productId',
});
console.log(chalk.green('Collection "cards" created successfully.'));
} else {
@@ -54,6 +55,7 @@ async function preloadSearchIndex() {
await client.collections('cards').documents().import(pokemon.map(card => ({
productId: card.productId,
variant: card.variant,
productName: card.productName,
productLineName: card.productLineName,
rarityName: card.rarityName,