diff options
Diffstat (limited to 'lib/tech-vendors')
| -rw-r--r-- | lib/tech-vendors/service.ts | 23 | ||||
| -rw-r--r-- | lib/tech-vendors/table/tech-vendors-table-columns.tsx | 5 | ||||
| -rw-r--r-- | lib/tech-vendors/validations.ts | 3 |
3 files changed, 23 insertions, 8 deletions
diff --git a/lib/tech-vendors/service.ts b/lib/tech-vendors/service.ts index b2dec1ab..5fd5ef02 100644 --- a/lib/tech-vendors/service.ts +++ b/lib/tech-vendors/service.ts @@ -78,6 +78,25 @@ export async function getTechVendors(input: GetTechVendorsSchema) { // 최종 where 결합 const finalWhere = and(advancedWhere, globalWhere); + // 벤더 타입 필터링 로직 추가 + let vendorTypeWhere; + if (input.vendorType) { + // URL의 vendorType 파라미터를 실제 벤더 타입으로 매핑 + const vendorTypeMap = { + "ship": "조선", + "top": "해양TOP", + "hull": "해양HULL" + }; + + const actualVendorType = input.vendorType in vendorTypeMap + ? vendorTypeMap[input.vendorType as keyof typeof vendorTypeMap] + : undefined; + if (actualVendorType) { + // techVendorType 필드는 콤마로 구분된 문자열이므로 LIKE 사용 + vendorTypeWhere = ilike(techVendors.techVendorType, `%${actualVendorType}%`); + } + } + // 간단 검색 (advancedTable=false) 시 예시 const simpleWhere = and( input.vendorName @@ -89,8 +108,8 @@ export async function getTechVendors(input: GetTechVendorsSchema) { : undefined ); - // 실제 사용될 where - const where = finalWhere; + // 실제 사용될 where (vendorType 필터링 추가) + const where = and(finalWhere, vendorTypeWhere); // 정렬 const orderBy = diff --git a/lib/tech-vendors/table/tech-vendors-table-columns.tsx b/lib/tech-vendors/table/tech-vendors-table-columns.tsx index e586a667..093b5547 100644 --- a/lib/tech-vendors/table/tech-vendors-table-columns.tsx +++ b/lib/tech-vendors/table/tech-vendors-table-columns.tsx @@ -131,11 +131,6 @@ export function getColumns({ setRowAction, router }: GetColumnsProps): ColumnDef > 상세보기(새창) </DropdownMenuItem> - <DropdownMenuItem - onSelect={() => setRowAction({ row, type: "log" })} - > - 감사 로그 보기 - </DropdownMenuItem> <Separator /> <DropdownMenuSub> diff --git a/lib/tech-vendors/validations.ts b/lib/tech-vendors/validations.ts index c45eb97d..ee076945 100644 --- a/lib/tech-vendors/validations.ts +++ b/lib/tech-vendors/validations.ts @@ -46,7 +46,8 @@ export const searchParamsCache = createSearchParamsCache({ // 예) 코드 검색 vendorCode: parseAsString.withDefault(""), - + // 벤더 타입 필터링 (다중 선택 가능) + vendorType: parseAsStringEnum(["ship", "top", "hull"]), // 필요하다면 이메일 검색 / 웹사이트 검색 등 추가 가능 email: parseAsString.withDefault(""), website: parseAsString.withDefault(""), |
