Truncate product name to 255 chars before DB insert

Prevents Postgres VARCHAR(255) overflow error when scraping pages
with long product titles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Daugherty 2026-02-09 17:53:02 -07:00
parent 33b944588d
commit bdc87cad86

View file

@ -48,7 +48,7 @@ router.post('/', async (req: AuthRequest, res: Response) => {
const product = await productQueries.create(
userId,
url,
scrapedData.name,
scrapedData.name?.substring(0, 255) ?? null,
scrapedData.imageUrl,
refresh_interval || 3600,
scrapedData.stockStatus
@ -133,7 +133,7 @@ router.post('/', async (req: AuthRequest, res: Response) => {
const product = await productQueries.create(
userId,
url,
scrapedData.name,
scrapedData.name?.substring(0, 255) ?? null,
scrapedData.imageUrl,
refresh_interval || 3600,
scrapedData.stockStatus