feature/survey - 조사매물 목록 조회 필터링 조건 변경 및 임시저장 구현 #42

Merged
swyoo merged 12 commits from feature/survey into dev 2025-05-22 10:27:55 +09:00
Showing only changes of commit a58c58afca - Show all commits

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':
// 모든 매물 조회 가능 (추가 조건 없음)