diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-24 01:44:03 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-24 01:44:03 +0000 |
| commit | 4e63d8427d26d0d1b366ddc53650e15f3481fc75 (patch) | |
| tree | ddfb69a92db56498ea591eed0f14ed2ce823431c /lib/tech-vendors/service.ts | |
| parent | 127185717263ea3162bd192c83b4c7efe0d96e50 (diff) | |
(대표님/최겸) 20250624 작업사항 10시43분
Diffstat (limited to 'lib/tech-vendors/service.ts')
| -rw-r--r-- | lib/tech-vendors/service.ts | 23 |
1 files changed, 21 insertions, 2 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 = |
