Merge pull request 'dev' (#94) from dev into dev-deploy
Reviewed-on: #94
This commit is contained in:
commit
ac00777cf1
42
src/app/api/image/estimate-image-copy/route.js
Normal file
42
src/app/api/image/estimate-image-copy/route.js
Normal file
@ -0,0 +1,42 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { S3Client, CopyObjectCommand } from '@aws-sdk/client-s3'
|
||||
import sharp from 'sharp'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
const Bucket = process.env.AMPLIFY_BUCKET
|
||||
const s3 = new S3Client({
|
||||
region: process.env.AWS_REGION,
|
||||
credentials: {
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
||||
},
|
||||
})
|
||||
|
||||
export async function POST(req) {
|
||||
try {
|
||||
const { objectNo, planNo, newObjectNo, newPlanNo } = await req.json()
|
||||
|
||||
const responseArray = []
|
||||
|
||||
const copyCommand = new CopyObjectCommand({
|
||||
Bucket,
|
||||
CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_1.png`),
|
||||
Key: `Drawing/${newObjectNo}_${newPlanNo}_1.png`,
|
||||
})
|
||||
|
||||
const response = await s3.send(copyCommand)
|
||||
|
||||
const copyCommand2 = new CopyObjectCommand({
|
||||
Bucket,
|
||||
CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_2.png`),
|
||||
Key: `Drawing/${newObjectNo}_${newPlanNo}_2.png`,
|
||||
})
|
||||
|
||||
const response2 = await s3.send(copyCommand2)
|
||||
|
||||
responseArray.push(response, response2)
|
||||
return NextResponse.json({ message: '견적서 이미지 복사 성공', responseArray }, { status: 200 })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return NextResponse.json({ message: '견적서 이미지 복사 실패' }, { status: 500 })
|
||||
}
|
||||
}
|
||||
@ -1281,7 +1281,7 @@ export default function Estimate({}) {
|
||||
<div className="estimate-box">
|
||||
<div className="estimate-tit">{getMessage('estimate.detail.objectNo')}</div>
|
||||
<div className="estimate-name">
|
||||
{currentObjectNo} (Plan No: {planNo})
|
||||
{currentObjectNo} (Plan No: {currentPid})
|
||||
</div>
|
||||
</div>
|
||||
<div className="estimate-box">
|
||||
|
||||
@ -13,6 +13,8 @@ import { useSwal } from '@/hooks/useSwal'
|
||||
// Constants
|
||||
const ESTIMATE_API_ENDPOINT = '/api/estimate' // API 엔드포인트 정의
|
||||
|
||||
import Config from '@/config/config.export'
|
||||
|
||||
// Helper functions
|
||||
const updateItemInList = (itemList, dispOrder, updates) => {
|
||||
return itemList.map((item) => (item.dispOrder === dispOrder ? { ...item, ...updates } : item))
|
||||
@ -464,11 +466,13 @@ export const useEstimateController = (planNo, flag) => {
|
||||
|
||||
setIsGlobalLoading(true)
|
||||
await promisePost({ url: '/api/estimate/save-estimate-copy', data: params })
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
setIsGlobalLoading(false)
|
||||
if (res.status === 201) {
|
||||
if (isObjectNotEmpty(res.data)) {
|
||||
let newObjectNo = res.data.objectNo
|
||||
const copyImage = await handleEstimateImageCopy(params.objectNo, params.planNo, newObjectNo, '1')
|
||||
|
||||
swalFire({
|
||||
text: getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage'),
|
||||
type: 'alert',
|
||||
@ -489,6 +493,14 @@ export const useEstimateController = (planNo, flag) => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleEstimateImageCopy = async (objectNo, planNo, newObjectNo, newPlanNo) => {
|
||||
await promisePost({ url: `${Config().baseUrl}/api/image/estimate-image-copy`, data: { objectNo, planNo, newObjectNo, newPlanNo } }).then(
|
||||
(res) => {
|
||||
return res
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
const handleDeleteEstimate = async (canvasStatus) => {
|
||||
try {
|
||||
setIsGlobalLoading(true)
|
||||
|
||||
@ -689,12 +689,12 @@
|
||||
"join.sub2.fax_placeholder": "00 0000 0000",
|
||||
"join.sub2.category": "部署名",
|
||||
"join.btn.login_page": "ログイン画面に移動",
|
||||
"join.btn.approval_request": "ID承認要求",
|
||||
"join.btn.approval_request": "ID申請",
|
||||
"join.complete.title": "HANASYS設計ログインID発行申請完了",
|
||||
"join.complete.contents": "※申請したIDが承認されると、担当者情報に入力したEメールアドレスにログイン関連案内メールが送信されます。",
|
||||
"join.complete.email_comment": "担当者のメールアドレス",
|
||||
"join.validation.check1": "{0}形式を確認してください。",
|
||||
"join.complete.save.confirm": "ハンファジャパンの担当者にID承認が要求された場合、これ以上情報を修正することはできません。申請しますか?",
|
||||
"join.complete.save.confirm": "ID申請を完了後は申請情報の修正が出来ません。申請しますか?",
|
||||
"stuff.gridHeader.lastEditDatetime": "更新日時",
|
||||
"stuff.gridHeader.objectNo": "物件番号",
|
||||
"stuff.gridHeader.planTotCnt": "プラン数",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user