From b12a06766e32e3c76544b1d12bec91653e1fe9db Mon Sep 17 00:00:00 2001 From: 0-Zz-ang Date: Mon, 25 Aug 2025 09:23:30 +0900 Subject: docu-list-rule페이지 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/docu-list-rule/code-groups/service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/docu-list-rule/code-groups/service.ts') diff --git a/lib/docu-list-rule/code-groups/service.ts b/lib/docu-list-rule/code-groups/service.ts index c854f6c9..d9b3b859 100644 --- a/lib/docu-list-rule/code-groups/service.ts +++ b/lib/docu-list-rule/code-groups/service.ts @@ -15,6 +15,7 @@ export async function getCodeGroups(input: { filters: Array<{ id: string; value: string | string[] }> joinOperator: "and" | "or" sort: Array<{ id: string; desc: boolean }> + projectId?: string }) { unstable_noStore() @@ -25,10 +26,15 @@ export async function getCodeGroups(input: { // 검색 조건 (plant 타입 프로젝트만) let whereConditions = sql`${projects.type} = 'plant'` + // 프로젝트 ID 필터링 + if (input.projectId) { + whereConditions = sql`${whereConditions} AND ${codeGroups.projectId} = ${parseInt(input.projectId)}` + } + // 검색어 필터링 if (search) { const searchTerm = `%${search}%` - whereConditions = sql`${projects.type} = 'plant' AND ( + whereConditions = sql`${whereConditions} AND ( ${codeGroups.groupId} ILIKE ${searchTerm} OR ${codeGroups.description} ILIKE ${searchTerm} OR ${codeGroups.codeFormat} ILIKE ${searchTerm} OR -- cgit v1.2.3