diff --git a/src/components/cards/CardDatabaseBrowser.tsx b/src/components/cards/CardDatabaseBrowser.tsx index 3db582a..042a384 100644 --- a/src/components/cards/CardDatabaseBrowser.tsx +++ b/src/components/cards/CardDatabaseBrowser.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; -import { tcgApi } from '../../services/tcgApi'; + import cardDataService from '../../services/cardDataSources'; import type { Card } from '../../types'; diff --git a/src/services/cardDataSources.ts b/src/services/cardDataSources.ts index fe28f82..b165a83 100644 --- a/src/services/cardDataSources.ts +++ b/src/services/cardDataSources.ts @@ -70,8 +70,8 @@ export const mtgService = { toughness: card.toughness, image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal, - current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, - market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, + current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined, + market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined, verified: true, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -113,8 +113,8 @@ export const mtgService = { toughness: card.toughness, image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal, - current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, - market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, + current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined, + market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined, verified: true, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -155,8 +155,8 @@ export const mtgService = { toughness: card.toughness, image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal, - current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, - market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, + current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined, + market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined, verified: true, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -204,8 +204,8 @@ export const pokemonService = { toughness: null, image_url: card.images.small, stock_image_url: card.images.large, - current_price: card.cardmarket?.prices?.averageSellPrice || null, - market_price: card.cardmarket?.prices?.lowPrice || null, + current_price: card.cardmarket?.prices?.averageSellPrice || undefined, + market_price: card.cardmarket?.prices?.lowPrice || undefined, verified: true, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), @@ -256,8 +256,8 @@ export const yugiohService = { toughness: card.def?.toString(), image_url: card.card_images?.[0]?.image_url, stock_image_url: card.card_images?.[0]?.image_url_small, - current_price: card.card_prices?.[0]?.amazon_price ? parseFloat(card.card_prices[0].amazon_price) : null, - market_price: card.card_prices?.[0]?.cardmarket_price ? parseFloat(card.card_prices[0].cardmarket_price) : null, + current_price: card.card_prices?.[0]?.amazon_price ? parseFloat(card.card_prices[0].amazon_price) : undefined, + market_price: card.card_prices?.[0]?.cardmarket_price ? parseFloat(card.card_prices[0].cardmarket_price) : undefined, verified: true, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(),