[feat] implemented product variants
This commit is contained in:
@@ -148,10 +148,10 @@ async function syncProductLine(productLine: string, field: string, fieldValue: s
|
||||
const detailData = await detailResponse.json();
|
||||
|
||||
|
||||
await db.insert(schema.cards).values({
|
||||
await db.insert(schema.tcgcards).values({
|
||||
productId: item.productId,
|
||||
originalProductName: item.productName,
|
||||
productName: cleanProductName(item.productName),
|
||||
productName: item.productName,
|
||||
//productName: cleanProductName(item.productName),
|
||||
rarityName: item.rarityName,
|
||||
productLineName: item.productLineName,
|
||||
productLineUrlName: item.productLineUrlName,
|
||||
@@ -187,8 +187,8 @@ async function syncProductLine(productLine: string, field: string, fieldValue: s
|
||||
Artist: detailData.formattedAttributes.Artist || null,
|
||||
}).onDuplicateKeyUpdate({
|
||||
set: {
|
||||
originalProductName: item.productName,
|
||||
productName: cleanProductName(item.productName),
|
||||
productName: item.productName,
|
||||
//productName: cleanProductName(item.productName),
|
||||
rarityName: item.rarityName,
|
||||
productLineName: item.productLineName,
|
||||
productLineUrlName: item.productLineUrlName,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user