Compare commits

..

No commits in common. "009353319d2840983e6d689f0ede8775a0d84b57" and "4118af35cd9ea57219a01ffa89999a389baa82e4" have entirely different histories.

2 changed files with 17 additions and 8 deletions

View File

@ -28,7 +28,6 @@ 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?
}

View File

@ -168,8 +168,7 @@ export class SurveySalesService {
if (Object.keys(roleCondition).length > 0) {
where.AND.push(roleCondition)
}
/** 삭제된 매물 제외 */
return { AND: [...where.AND, { DEL_YN: { equals: 'N' } }] }
return where
}
/**
@ -260,7 +259,7 @@ export class SurveySalesService {
async fetchSurvey(id: number, isPdf: boolean): Promise<SurveyBasicInfo | ApiError | Blob> {
// @ts-ignore
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
where: { ID: id, DEL_YN: 'N' },
where: { ID: id },
include: { DETAIL_INFO: true },
})
if (!result) {
@ -330,13 +329,24 @@ export class SurveySalesService {
async deleteSurvey(id: number) {
await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
// @ts-ignore
await tx.SD_SURVEY_SALES_BASIC_INFO.update({
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
where: { ID: Number(id) },
data: {
DEL_YN: 'Y',
UPT_DT: new Date(),
select: {
DETAIL_INFO: true,
},
})
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) },
})
})
}