From 519d01ed0a2e40c353d0afcccd4b7a83483f7eaf Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Wed, 12 Nov 2025 18:58:10 +0900
Subject: (김준회) Document Numbering Rule(해양): DOC_CLASS 1글자로 제한 (SWP측
제약), DOC_CLASS에서 코드 컬럼 제거
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/docu-list-rule/document-class/service.ts | 8 ++---
.../table/document-class-add-dialog.tsx | 2 +-
.../table/document-class-edit-sheet.tsx | 23 +++++++++++---
.../table/document-class-table-columns.tsx | 35 ++++++++++++++--------
.../document-class/table/document-class-table.tsx | 7 ++---
5 files changed, 47 insertions(+), 28 deletions(-)
(limited to 'lib/docu-list-rule')
diff --git a/lib/docu-list-rule/document-class/service.ts b/lib/docu-list-rule/document-class/service.ts
index 9d3ff23a..0dc4a4f4 100644
--- a/lib/docu-list-rule/document-class/service.ts
+++ b/lib/docu-list-rule/document-class/service.ts
@@ -4,7 +4,7 @@ import { revalidatePath } from "next/cache"
import db from "@/db/db"
import { documentClasses, documentClassOptions, codeGroups } from "@/db/schema/docu-list-rule"
import { projects } from "@/db/schema/projects"
-import { eq, desc, sql, and } from "drizzle-orm"
+import { eq, sql, and } from "drizzle-orm"
// Document Class 목록 조회 (A Class, B Class 등)
export async function getDocumentClassCodeGroups(input: {
@@ -36,7 +36,6 @@ export async function getDocumentClassCodeGroups(input: {
if (search) {
const searchTerm = `%${search}%`
whereConditions = sql`${whereConditions} AND (
- ${documentClasses.code} ILIKE ${searchTerm} OR
${documentClasses.value} ILIKE ${searchTerm} OR
${documentClasses.description} ILIKE ${searchTerm} OR
${projects.code} ILIKE ${searchTerm}
@@ -50,8 +49,6 @@ export async function getDocumentClassCodeGroups(input: {
if (!value) return null
switch (id) {
- case "code":
- return sql`${documentClasses.code} ILIKE ${`%${value}%`}`
case "value":
return sql`${documentClasses.value} ILIKE ${`%${value}%`}`
case "description":
@@ -79,7 +76,7 @@ export async function getDocumentClassCodeGroups(input: {
}
// 정렬 (안전한 필드 체크 적용)
- let orderBy = sql`${documentClasses.code} ASC`
+ let orderBy = sql`${documentClasses.value} ASC`
if (sort && sort.length > 0) {
const sortField = sort[0]
// 안전성 체크: 필드가 실제 테이블에 존재하는지 확인
@@ -100,7 +97,6 @@ export async function getDocumentClassCodeGroups(input: {
const data = await db
.select({
id: documentClasses.id,
- code: documentClasses.code,
value: documentClasses.value,
description: documentClasses.description,
isActive: documentClasses.isActive,
diff --git a/lib/docu-list-rule/document-class/table/document-class-add-dialog.tsx b/lib/docu-list-rule/document-class/table/document-class-add-dialog.tsx
index 6e8ac686..471f2089 100644
--- a/lib/docu-list-rule/document-class/table/document-class-add-dialog.tsx
+++ b/lib/docu-list-rule/document-class/table/document-class-add-dialog.tsx
@@ -129,7 +129,7 @@ export function DocumentClassAddDialog({
/>
- 💡 대문자 알파벳 또는 숫자 1자리 (A, B, 0, 1 등) - API DOC_CLASS로 전송됩니다
+ 대문자 알파벳 1자리 또는 숫자 1자리 (A, B, 0, 1 등)
diff --git a/lib/docu-list-rule/document-class/table/document-class-edit-sheet.tsx b/lib/docu-list-rule/document-class/table/document-class-edit-sheet.tsx
index 32c1976d..03bded67 100644
--- a/lib/docu-list-rule/document-class/table/document-class-edit-sheet.tsx
+++ b/lib/docu-list-rule/document-class/table/document-class-edit-sheet.tsx
@@ -31,7 +31,10 @@ import { updateDocumentClassCodeGroup } from "@/lib/docu-list-rule/document-clas
import { documentClasses } from "@/db/schema/docu-list-rule"
const updateDocumentClassSchema = z.object({
- value: z.string().min(1, "Value는 필수입니다."),
+ value: z.string()
+ .min(1, "Value는 필수입니다.")
+ .max(1, "Value는 1자리만 입력 가능합니다. (예: A, B, 0, 1)")
+ .regex(/^[A-Z0-9]$/, "대문자 알파벳 또는 숫자 1자리만 입력 가능합니다. (예: A, B, 0, 1)"),
description: z.string().optional(),
})
@@ -111,10 +114,19 @@ export function DocumentClassEditSheet({
name="value"
render={({ field }) => (
- Value
+ Value *
-
+ field.onChange(e.target.value.toUpperCase())}
+ />
+
+ 대문자 알파벳 1자리 또는 숫자 1자리 (A, B, 0, 1 등)
+
)}
@@ -126,8 +138,11 @@ export function DocumentClassEditSheet({
Description
-
+
+
+ 선택사항: Document Class에 대한 추가 설명
+
)}
diff --git a/lib/docu-list-rule/document-class/table/document-class-table-columns.tsx b/lib/docu-list-rule/document-class/table/document-class-table-columns.tsx
index 9d8d91e0..6b4a882f 100644
--- a/lib/docu-list-rule/document-class/table/document-class-table-columns.tsx
+++ b/lib/docu-list-rule/document-class/table/document-class-table-columns.tsx
@@ -110,35 +110,44 @@ export function getColumns({ setRowAction, onDetail }: GetColumnsProps): ColumnD
accessorKey: "value",
enableResizing: true,
header: ({ column }) => (
-
+
),
meta: {
- excelHeader: "클래스",
+ excelHeader: "DOC_CLASS",
type: "text",
},
cell: ({ row }) => {
const value = row.getValue("value") as string
+ return {value}
+ },
+ minSize: 80
+ },
+
+ {
+ accessorKey: "description",
+ enableResizing: true,
+ header: ({ column }) => (
+
+ ),
+ meta: {
+ excelHeader: "Description",
+ type: "text",
+ },
+ cell: ({ row }) => {
const description = row.getValue("description") as string
- return (
-
- {value}
- {description && (
- - {description}
- )}
-
- )
+ return {description || "-"}
},
- minSize: 250
+ minSize: 200
},
{
accessorKey: "createdAt",
enableResizing: true,
header: ({ column }) => (
-
+
),
meta: {
- excelHeader: "생성일",
+ excelHeader: "createdAt",
type: "date",
},
cell: ({ row }) => {
diff --git a/lib/docu-list-rule/document-class/table/document-class-table.tsx b/lib/docu-list-rule/document-class/table/document-class-table.tsx
index 11ec3a3c..771e95ab 100644
--- a/lib/docu-list-rule/document-class/table/document-class-table.tsx
+++ b/lib/docu-list-rule/document-class/table/document-class-table.tsx
@@ -38,10 +38,9 @@ export function DocumentClassTable({ promises }: DocumentClassTableProps) {
// 고급 필터 필드 설정
const advancedFilterFields: DataTableAdvancedFilterField[] = [
- { id: "code", label: "코드", type: "text" },
- { id: "value", label: "값", type: "text" },
- { id: "description", label: "설명", type: "text" },
- { id: "createdAt", label: "생성일", type: "date" },
+ { id: "value", label: "DOC_CLASS", type: "text" },
+ { id: "description", label: "Description", type: "text" },
+ { id: "createdAt", label: "createdAt", type: "date" },
]
const { table } = useDataTable({
--
cgit v1.2.3