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