fix: 조사매물 삭제 정책 변경
- 삭제 플래그 추가 되어 조회 로직 및 삭제 로직 변경
This commit is contained in:
parent
5651476e78
commit
84d2b9e4ce
@ -168,7 +168,8 @@ export class SurveySalesService {
|
|||||||
if (Object.keys(roleCondition).length > 0) {
|
if (Object.keys(roleCondition).length > 0) {
|
||||||
where.AND.push(roleCondition)
|
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<SurveyBasicInfo | ApiError | Blob> {
|
async fetchSurvey(id: number, isPdf: boolean): Promise<SurveyBasicInfo | ApiError | Blob> {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
||||||
where: { ID: id },
|
where: { ID: id, DEL_YN: 'N' },
|
||||||
include: { DETAIL_INFO: true },
|
include: { DETAIL_INFO: true },
|
||||||
})
|
})
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -329,24 +330,13 @@ export class SurveySalesService {
|
|||||||
async deleteSurvey(id: number) {
|
async deleteSurvey(id: number) {
|
||||||
await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
|
await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
await tx.SD_SURVEY_SALES_BASIC_INFO.update({
|
||||||
where: { ID: Number(id) },
|
where: { ID: Number(id) },
|
||||||
select: {
|
data: {
|
||||||
DETAIL_INFO: true,
|
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) },
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user