summaryrefslogtreecommitdiff
path: root/lib/tech-vendors/service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tech-vendors/service.ts')
-rw-r--r--lib/tech-vendors/service.ts23
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 =