diff options
Diffstat (limited to 'app/api/vendor-responses/waive')
| -rw-r--r-- | app/api/vendor-responses/waive/route.ts | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/app/api/vendor-responses/waive/route.ts b/app/api/vendor-responses/waive/route.ts deleted file mode 100644 index e732e8d2..00000000 --- a/app/api/vendor-responses/waive/route.ts +++ /dev/null @@ -1,69 +0,0 @@ -// app/api/vendor-responses/waive/route.ts -import { NextRequest, NextResponse } from "next/server"; -import db from "@/db/db"; -import { getServerSession } from "next-auth/next" -import { authOptions } from "@/app/api/auth/[...nextauth]/route" -import { eq } from "drizzle-orm"; -import { vendorAttachmentResponses } from "@/db/schema"; - -export async function POST(request: NextRequest) { - try { - // 인증 확인 - const session = await getServerSession(authOptions); - if (!session?.user?.id) { - return NextResponse.json( - { message: "인증이 필요합니다." }, - { status: 401 } - ); - } - - const body = await request.json(); - const { responseId, responseComment, vendorComment } = body; - - if (!responseId) { - return NextResponse.json( - { message: "응답 ID가 필요합니다." }, - { status: 400 } - ); - } - - if (!responseComment) { - return NextResponse.json( - { message: "포기 사유를 입력해주세요." }, - { status: 400 } - ); - } - - // vendor response를 WAIVED 상태로 업데이트 - const [updatedResponse] = await db - .update(vendorAttachmentResponses) - .set({ - responseStatus: "WAIVED", - responseComment, - vendorComment, - respondedAt: new Date(), - updatedAt: new Date(), - }) - .where(eq(vendorAttachmentResponses.id, parseInt(responseId))) - .returning(); - - if (!updatedResponse) { - return NextResponse.json( - { message: "응답을 찾을 수 없습니다." }, - { status: 404 } - ); - } - - return NextResponse.json({ - message: "응답이 성공적으로 포기 처리되었습니다.", - response: updatedResponse, - }); - - } catch (error) { - console.error("Waive response error:", error); - return NextResponse.json( - { message: "응답 포기 처리 중 오류가 발생했습니다." }, - { status: 500 } - ); - } -}
\ No newline at end of file |
