Compare commits
No commits in common. "713b773dc0d8cae1666c5b27a00062c553e1c5bc" and "72bbf333173758e84dcae2d39f098c65ddbdcddb" have entirely different histories.
713b773dc0
...
72bbf33317
@ -12,29 +12,28 @@ const s3 = new S3Client({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export async function POST(req) {
|
export async function POST(req) {
|
||||||
const { objectNo, planNo, newObjectNo, newPlanNo } = await req.json()
|
try {
|
||||||
|
const { objectNo, planNo, newObjectNo, newPlanNo } = await req.json()
|
||||||
|
|
||||||
const responseArray = []
|
const responseArray = []
|
||||||
|
|
||||||
//견적서1 번 이미지
|
// const isExistImage1 = await s3.send(
|
||||||
const isExistImage1 = await s3.send(
|
// new GetObjectCommand({
|
||||||
new GetObjectCommand({
|
// Bucket,
|
||||||
Bucket,
|
// Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
||||||
Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
// }),
|
||||||
}),
|
// )
|
||||||
)
|
|
||||||
|
|
||||||
//견적서2 번 이미지
|
// const isExistImage2 = await s3.send(
|
||||||
const isExistImage2 = await s3.send(
|
// new GetObjectCommand({
|
||||||
new GetObjectCommand({
|
// Bucket,
|
||||||
Bucket,
|
// Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
||||||
Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
// }),
|
||||||
}),
|
// )
|
||||||
)
|
|
||||||
|
// console.log('🚀 ~ isExistImage1:', isExistImage1.$metadata.httpStatusCode === 200)
|
||||||
|
// console.log('🚀 ~ isExistImage2:', isExistImage2.$metadata.httpStatusCode === 200)
|
||||||
|
|
||||||
//견적서1,2 번 이미지 둘다 있어야함
|
|
||||||
if (isExistImage1.$metadata.httpStatusCode === 200 && isExistImage2.$metadata.httpStatusCode === 200) {
|
|
||||||
//견적서1 번 이미지 복사
|
|
||||||
const copyCommand = new CopyObjectCommand({
|
const copyCommand = new CopyObjectCommand({
|
||||||
Bucket,
|
Bucket,
|
||||||
CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_1.png`),
|
CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_1.png`),
|
||||||
@ -53,7 +52,8 @@ export async function POST(req) {
|
|||||||
|
|
||||||
responseArray.push(response, response2)
|
responseArray.push(response, response2)
|
||||||
return NextResponse.json({ message: '견적서 이미지 복사 성공', responseArray }, { status: 200 })
|
return NextResponse.json({ message: '견적서 이미지 복사 성공', responseArray }, { status: 200 })
|
||||||
} else {
|
} catch (error) {
|
||||||
return NextResponse.json({ message: '견적서 이미지 복사 실패(존재하지 않는 이미지)', responseArray }, { status: 400 })
|
console.error(error)
|
||||||
|
return NextResponse.json({ message: '견적서 이미지 복사 실패' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user