fix: fix prisma syntax for filtering temporary save data for T01 to Read survey list

This commit is contained in:
Dayoung 2025-05-21 10:29:08 +09:00
parent b3550ff497
commit a58c58afca

View File

@ -77,31 +77,27 @@ const createKeywordSearchCondition = (keyword: string, searchOption: string): Wh
return where
}
const filterTempData = (data: any) => {
// 임시저장 데이터 필터링 - T01 만 적용
const filterTempData = () => {
const requiredFields = [
'INSTALLATION_SYSTEM',
'CONSTRUCTION_YEAR',
'RAFTER_SIZE',
'RAFTER_PITCH',
'RAFTER_PITH_ETC',
'WATERPROOF_MATERIAL',
'INSULATION_PRESENCE',
'STRUCTURE_ORDER',
]
const where: WhereCondition = { AND: [] }
// 각 필드에 대해 OR 조건을 만들고, 전체를 AND로 묶음
where.AND.push(
...requiredFields.map((field: string) => ({
OR: [
{ [field]: { not: null } },
{ [`${field}_ETC`]: { not: null } }
]
}))
)
return where
return {
DETAIL_INFO: {
is: {
AND: requiredFields.map((field: string) => ({
OR: [{ [field]: { not: null } }, { [`${field}_ETC`]: { not: null } }],
})),
},
},
}
}
/**
@ -155,7 +151,7 @@ const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
break
case 'T01':
where.AND.push(filterTempData(params))
where.AND.push(filterTempData())
break
case 'User':
// 모든 매물 조회 가능 (추가 조건 없음)