File tree Expand file tree Collapse file tree
src/app/api/quickbooks/product Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { withErrorHandler } from '@/app/api/core/utils/withErrorHandler'
2- import { getFlattenProducts } from '@/app/api/quickbooks/product/product.controller'
2+ import { getProductsWithPrices } from '@/app/api/quickbooks/product/product.controller'
33
44export const maxDuration = 300 // 5 minutes
55
6- export const GET = withErrorHandler ( getFlattenProducts )
6+ export const GET = withErrorHandler ( getProductsWithPrices )
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ import { ProductService } from '@/app/api/quickbooks/product/product.service'
55import { ProductMappingSchema } from '@/db/schema/qbProductSync'
66import { NextRequest , NextResponse } from 'next/server'
77
8- export async function getFlattenProducts ( req : NextRequest ) {
8+ export async function getProductsWithPrices ( req : NextRequest ) {
99 const user = await authenticate ( req )
1010 const productService = new ProductService ( user )
11- const products = await productService . getFlattenProductList ( )
11+ const products = await productService . getProductsWithPrices ( )
1212 return NextResponse . json ( products )
1313}
1414
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ export class ProductService extends BaseService {
319319 return await intuitApi . createItem ( qbItemPayload )
320320 }
321321
322- async getFlattenProductList ( ) : Promise < ProductFlattenArrayResponseType > {
322+ async getProductsWithPrices ( ) : Promise < ProductFlattenArrayResponseType > {
323323 const copilot = new CopilotAPI ( this . user . token )
324324
325325 const [ products , pricesByProduct ] = await Promise . all ( [
@@ -351,7 +351,7 @@ export class ProductService extends BaseService {
351351 * Walks every page of the workspace's /prices endpoint and groups by
352352 * productId. Replaces the prior bottleneck-throttled N+1 per-product fetch
353353 * with ceil(totalPrices / MAX_PRODUCT_LIST_LIMIT) sequential calls, which is
354- * dramatically faster for the single-page workload getFlattenProductList
354+ * dramatically faster for the single-page workload getProductsWithPrices
355355 * actually serves. If product pagination is ever reintroduced, revisit:
356356 * caller would repeat this full walk per page with no cross-call cache.
357357 */
You can’t perform that action at this time.
0 commit comments