diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-10 09:29:29 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-10 09:29:29 +0700 |
| commit | 38db9dbede5ee9d99068fb9a98941fd15c2730bf (patch) | |
| tree | 9e7756028d3db9d000c132abfc1f1667699b6d75 /src | |
| parent | 45dfcc28c0d1bb9742d842cf50f554f906c44506 (diff) | |
<iman> update import product
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/api/product/import/route.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/app/api/product/import/route.tsx b/src/app/api/product/import/route.tsx index e4e38c6..3f11def 100644 --- a/src/app/api/product/import/route.tsx +++ b/src/app/api/product/import/route.tsx @@ -19,13 +19,13 @@ export async function POST(request: NextRequest) { const newProducts = fileData.map(row => ({ id: undefined, isDifferent: false, - name: row[0].toString(), - barcode: row[1].toString(), - itemCode: row[2].toString(), - onhandQty: row[3], - differenceQty: row[4], - companyId: row[5], - externalId: row[6] ?? null + name: row[0]?.toString() || '', // Handle undefined values + barcode: row[1]?.toString() || '', // Handle undefined values + itemCode: row[2]?.toString() || '', // Handle undefined values + onhandQty: row[3] || 0, // Handle undefined values + differenceQty: row[4] || 0, // Handle undefined values + companyId: intCompanyId, // Use the parsed company ID + externalId: row[6] ? row[6].toString() : null // Handle undefined values })); const whereCompany = { companyId: intCompanyId } |
