diff --git a/src/app/api/survey-sales/route.ts b/src/app/api/survey-sales/route.ts index 7d51802..a1d818a 100644 --- a/src/app/api/survey-sales/route.ts +++ b/src/app/api/survey-sales/route.ts @@ -1,7 +1,6 @@ import { NextResponse } from 'next/server' import { prisma } from '@/libs/prisma' import { convertToSnakeCase } from '@/utils/common-utils' -import { equal } from 'assert' /** * 검색 파라미터 */ @@ -32,6 +31,7 @@ const SEARCH_OPTIONS = [ 'POST_CODE', // 우편번호 'ADDRESS', // 주소 'ADDRESS_DETAIL', // 상세주소 + 'SRL_NO', // 등록번호 ] as const // 페이지당 항목 수 @@ -50,13 +50,6 @@ const createKeywordSearchCondition = (keyword: string, searchOption: string): Wh // 모든 필드 검색 시 OR 조건 사용 where.OR = [] - // ID가 숫자인 경우 ID 검색 조건 추가 - if (keyword.match(/^\d+$/) || !isNaN(Number(keyword))) { - where.OR.push({ - ID: { equals: Number(keyword) }, - }) - } - where.OR.push( ...SEARCH_OPTIONS.map((field) => ({ [field]: { contains: keyword }, @@ -65,15 +58,6 @@ const createKeywordSearchCondition = (keyword: string, searchOption: string): Wh } else if (SEARCH_OPTIONS.includes(searchOption.toUpperCase() as any)) { // 특정 필드 검색 where[searchOption.toUpperCase()] = { contains: keyword } - } else if (searchOption === 'id') { - // ID 검색 (숫자 변환 필요) - const number = Number(keyword) - if (!isNaN(number)) { - where.ID = { equals: number } - } else { - // 유효하지 않은 ID 검색 시 빈 결과 반환 - where.ID = { equals: null } - } } return where } diff --git a/src/store/surveyFilterStore.ts b/src/store/surveyFilterStore.ts index 95514e8..a27f2fc 100644 --- a/src/store/surveyFilterStore.ts +++ b/src/store/surveyFilterStore.ts @@ -6,7 +6,7 @@ export const SEARCH_OPTIONS = [ label: '全体', }, { - id: 'id', + id: 'srl_no', label: '登録番号', }, { @@ -41,7 +41,7 @@ export const SEARCH_OPTIONS_PARTNERS = [ label: '全体', }, { - id: 'id', + id: 'srl_no', label: '登録番号', }, {