From 5651476e786e24654b8958611ab1a7eb34ff48f2 Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Mon, 4 Aug 2025 14:40:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=A1=B0=EC=82=AC=EB=A7=A4?= =?UTF-8?q?=EB=AC=BC=20=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EC=97=AC=EB=B6=80=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prisma/schema.prisma | 1 + 1 file changed, 1 insertion(+) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e7c2617..ace2673 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -28,6 +28,7 @@ model SD_SURVEY_SALES_BASIC_INFO { STORE_ID String? @db.NVarChar(100) CONSTRUCTION_POINT_ID String? @db.NVarChar(200) SUBMISSION_TARGET_NM String? @db.NVarChar(200) + DEL_YN String @default("N", map: "DF__SD_SURVEY__DEL_Y__4D5F7D71") @db.NVarChar(20) DETAIL_INFO SD_SURVEY_SALES_DETAIL_INFO? } From 84d2b9e4cefaf2b4c773600ea7da542afd4411fd Mon Sep 17 00:00:00 2001 From: keyy1315 Date: Mon, 4 Aug 2025 14:53:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=A1=B0=EC=82=AC=EB=A7=A4=EB=AC=BC?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EC=A0=95=EC=B1=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 삭제 플래그 추가 되어 조회 로직 및 삭제 로직 변경 --- src/app/api/survey-sales/service.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/app/api/survey-sales/service.ts b/src/app/api/survey-sales/service.ts index 5fc79cd..1418730 100644 --- a/src/app/api/survey-sales/service.ts +++ b/src/app/api/survey-sales/service.ts @@ -168,7 +168,8 @@ export class SurveySalesService { if (Object.keys(roleCondition).length > 0) { where.AND.push(roleCondition) } - return where + /** 삭제된 매물 제외 */ + return { AND: [...where.AND, { DEL_YN: { equals: 'N' } }] } } /** @@ -259,7 +260,7 @@ export class SurveySalesService { async fetchSurvey(id: number, isPdf: boolean): Promise { // @ts-ignore const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({ - where: { ID: id }, + where: { ID: id, DEL_YN: 'N' }, include: { DETAIL_INFO: true }, }) if (!result) { @@ -329,24 +330,13 @@ export class SurveySalesService { async deleteSurvey(id: number) { await prisma.$transaction(async (tx: Prisma.TransactionClient) => { // @ts-ignore - const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({ + await tx.SD_SURVEY_SALES_BASIC_INFO.update({ where: { ID: Number(id) }, - select: { - DETAIL_INFO: true, + data: { + DEL_YN: 'Y', + UPT_DT: new Date(), }, }) - - if (detailData?.DETAIL_INFO?.ID) { - // @ts-ignore - await tx.SD_SURVEY_SALES_DETAIL_INFO.delete({ - where: { ID: Number(detailData.DETAIL_INFO.ID) }, - }) - } - - // @ts-ignore - await tx.SD_SURVEY_SALES_BASIC_INFO.delete({ - where: { ID: Number(id) }, - }) }) }