플랜 복사시 견적서 이미지 복사 로직 추가
This commit is contained in:
parent
639c057e0c
commit
16c97ae041
@ -1,5 +1,5 @@
|
|||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import { S3Client, CopyObjectCommand } from '@aws-sdk/client-s3'
|
import { S3Client, CopyObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3'
|
||||||
import sharp from 'sharp'
|
import sharp from 'sharp'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
const Bucket = process.env.AMPLIFY_BUCKET
|
const Bucket = process.env.AMPLIFY_BUCKET
|
||||||
@ -17,6 +17,23 @@ export async function POST(req) {
|
|||||||
|
|
||||||
const responseArray = []
|
const responseArray = []
|
||||||
|
|
||||||
|
// const isExistImage1 = await s3.send(
|
||||||
|
// new GetObjectCommand({
|
||||||
|
// Bucket,
|
||||||
|
// Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
||||||
|
// }),
|
||||||
|
// )
|
||||||
|
|
||||||
|
// const isExistImage2 = await s3.send(
|
||||||
|
// new GetObjectCommand({
|
||||||
|
// Bucket,
|
||||||
|
// Key: `Drawing/${objectNo}_${planNo}_1.png`,
|
||||||
|
// }),
|
||||||
|
// )
|
||||||
|
|
||||||
|
// console.log('🚀 ~ isExistImage1:', isExistImage1.$metadata.httpStatusCode === 200)
|
||||||
|
// console.log('🚀 ~ isExistImage2:', isExistImage2.$metadata.httpStatusCode === 200)
|
||||||
|
|
||||||
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`),
|
||||||
|
|||||||
@ -535,5 +535,6 @@ export const useEstimateController = (planNo, flag) => {
|
|||||||
handleEstimateFileDownload,
|
handleEstimateFileDownload,
|
||||||
handleEstimateCopy,
|
handleEstimateCopy,
|
||||||
handleDeleteEstimate,
|
handleDeleteEstimate,
|
||||||
|
handleEstimateImageCopy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export function usePlan(params = {}) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, post, promisePost, promisePut, promiseDel, promiseGet } = useAxios()
|
const { get, post, promisePost, promisePut, promiseDel, promiseGet } = useAxios()
|
||||||
|
|
||||||
const { setEstimateContextState, handleDeleteEstimate } = useEstimateController()
|
const { setEstimateContextState, handleDeleteEstimate, handleEstimateImageCopy } = useEstimateController()
|
||||||
|
|
||||||
const resetOuterLinePoints = useResetRecoilState(outerLinePointsState)
|
const resetOuterLinePoints = useResetRecoilState(outerLinePointsState)
|
||||||
const resetPlacementShapeDrawingPoints = useResetRecoilState(placementShapeDrawingPointsState)
|
const resetPlacementShapeDrawingPoints = useResetRecoilState(placementShapeDrawingPointsState)
|
||||||
@ -79,7 +79,6 @@ export function usePlan(params = {}) {
|
|||||||
const resetCurrentObject = useResetRecoilState(currentObjectState)
|
const resetCurrentObject = useResetRecoilState(currentObjectState)
|
||||||
//선택된 모듈 배치면 초기화
|
//선택된 모듈 배치면 초기화
|
||||||
const resetModuleSetupSurface = useResetRecoilState(moduleSetupSurfaceState)
|
const resetModuleSetupSurface = useResetRecoilState(moduleSetupSurfaceState)
|
||||||
|
|
||||||
const { isAllComplete } = useTrestle()
|
const { isAllComplete } = useTrestle()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -308,6 +307,9 @@ export function usePlan(params = {}) {
|
|||||||
setModuleSelectionDataStore(copyData)
|
setModuleSelectionDataStore(copyData)
|
||||||
if (copyData.module) setSelectedModules(copyData.module)
|
if (copyData.module) setSelectedModules(copyData.module)
|
||||||
setSelectedMenu(currentSelectedMenu)
|
setSelectedMenu(currentSelectedMenu)
|
||||||
|
|
||||||
|
//이미지 복사
|
||||||
|
handleEstimateImageCopy(planData.objectNo, planData.planNo, planData.objectNo, newPlan.planNo)
|
||||||
} else {
|
} else {
|
||||||
setSelectedMenu('placement')
|
setSelectedMenu('placement')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user