diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-14 08:34:27 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-10-14 08:34:27 +0000 |
| commit | 80ab33adc277904e71dcf8c08e59390600226075 (patch) | |
| tree | cf6c754aca1bc33e7e0bd39fe7b182da5a974e13 /app/api | |
| parent | 6892880c16af3eb0027a77c9695b2fe462b4761e (diff) | |
(최겸) 구매 견젹 협력업체 제출 간 오류 수정
Diffstat (limited to 'app/api')
| -rw-r--r-- | app/api/partners/rfq-last/[id]/response/route.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/api/partners/rfq-last/[id]/response/route.ts b/app/api/partners/rfq-last/[id]/response/route.ts index bfbeb246..ebcccd8f 100644 --- a/app/api/partners/rfq-last/[id]/response/route.ts +++ b/app/api/partners/rfq-last/[id]/response/route.ts @@ -269,7 +269,14 @@ export async function PUT( await tx.update(rfqLastVendorResponses) .set({ isLatest: false }) .where(eq(rfqLastVendorResponses.id, existingResponse.id)) - + + // 기존 첨부파일을 새 응답으로 이동 + if (existingResponse.id) { + await tx.update(rfqLastVendorAttachments) + .set({ vendorResponseId: existingResponse.id }) // 임시로 기존 응답에 연결 + .where(eq(rfqLastVendorAttachments.vendorResponseId, existingResponse.id)) + } + // 새 버전 생성 const [newResponse] = await tx.insert(rfqLastVendorResponses).values({ ...data, @@ -282,7 +289,14 @@ export async function PUT( createdBy: existingResponse.createdBy, updatedBy: session.user.id, }).returning() - + + // 기존 첨부파일을 새 응답으로 이동 + if (newResponse.id) { + await tx.update(rfqLastVendorAttachments) + .set({ vendorResponseId: newResponse.id }) + .where(eq(rfqLastVendorAttachments.vendorResponseId, existingResponse.id)) + } + responseId = newResponse.id } else { // 기존 버전 업데이트 |
