Skip to content

Commit 550b9f5

Browse files
refactor(OUT-3545): use meaningful function name
1 parent 79c6431 commit 550b9f5

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { 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

44
export const maxDuration = 300 // 5 minutes
55

6-
export const GET = withErrorHandler(getFlattenProducts)
6+
export const GET = withErrorHandler(getProductsWithPrices)

src/app/api/quickbooks/product/product.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { ProductService } from '@/app/api/quickbooks/product/product.service'
55
import { ProductMappingSchema } from '@/db/schema/qbProductSync'
66
import { 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

src/app/api/quickbooks/product/product.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
*/

0 commit comments

Comments
 (0)