summaryrefslogtreecommitdiff
path: root/lib/docu-list-rule
diff options
context:
space:
mode:
Diffstat (limited to 'lib/docu-list-rule')
-rw-r--r--lib/docu-list-rule/document-class/service.ts8
-rw-r--r--lib/docu-list-rule/document-class/table/document-class-add-dialog.tsx2
-rw-r--r--lib/docu-list-rule/document-class/table/document-class-edit-sheet.tsx23
-rw-r--r--lib/docu-list-rule/document-class/table/document-class-table-columns.tsx35
-rw-r--r--lib/docu-list-rule/document-class/table/document-class-table.tsx7
5 files changed, 47 insertions, 28 deletions
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({
/>
</FormControl>
<div className="text-xs text-muted-foreground mt-1">
- 💡 대문자 알파벳 또는 숫자 1자리 (A, B, 0, 1 등) - API DOC_CLASS로 전송됩니다
+ 대문자 알파벳 1자리 또는 숫자 1자리 (A, B, 0, 1 등)
</div>
<FormMessage />
</FormItem>
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 }) => (
<FormItem>
- <FormLabel>Value</FormLabel>
+ <FormLabel>Value *</FormLabel>
<FormControl>
- <Input placeholder="예: A Class" {...field} />
+ <Input
+ {...field}
+ placeholder="예: A"
+ maxLength={1}
+ className="uppercase"
+ onChange={(e) => field.onChange(e.target.value.toUpperCase())}
+ />
</FormControl>
+ <div className="text-xs text-muted-foreground mt-1">
+ 대문자 알파벳 1자리 또는 숫자 1자리 (A, B, 0, 1 등)
+ </div>
<FormMessage />
</FormItem>
)}
@@ -126,8 +138,11 @@ export function DocumentClassEditSheet({
<FormItem>
<FormLabel>Description</FormLabel>
<FormControl>
- <Input placeholder="예: Document Class_1 (선택사항)" {...field} />
+ <Input placeholder="예: General Documents (선택사항)" {...field} />
</FormControl>
+ <div className="text-xs text-muted-foreground mt-1">
+ 선택사항: Document Class에 대한 추가 설명
+ </div>
<FormMessage />
</FormItem>
)}
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 }) => (
- <DataTableColumnHeaderSimple column={column} title="클래스" />
+ <DataTableColumnHeaderSimple column={column} title="DOC_CLASS" />
),
meta: {
- excelHeader: "클래스",
+ excelHeader: "DOC_CLASS",
type: "text",
},
cell: ({ row }) => {
const value = row.getValue("value") as string
+ return <span className="">{value}</span>
+ },
+ minSize: 80
+ },
+
+ {
+ accessorKey: "description",
+ enableResizing: true,
+ header: ({ column }) => (
+ <DataTableColumnHeaderSimple column={column} title="Description" />
+ ),
+ meta: {
+ excelHeader: "Description",
+ type: "text",
+ },
+ cell: ({ row }) => {
const description = row.getValue("description") as string
- return (
- <div className="flex items-center gap-2">
- <span className="font-mono font-bold text-lg">{value}</span>
- {description && (
- <span className="text-muted-foreground text-sm">- {description}</span>
- )}
- </div>
- )
+ return <span>{description || "-"}</span>
},
- minSize: 250
+ minSize: 200
},
{
accessorKey: "createdAt",
enableResizing: true,
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="생성일" />
+ <DataTableColumnHeaderSimple column={column} title="createdAt" />
),
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<typeof documentClasses.$inferSelect>[] = [
- { 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({