From e0dfb55c5457aec489fc084c4567e791b4c65eb1 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 26 Mar 2025 00:37:41 +0000 Subject: 3/25 까지의 대표님 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/userColumnsConfig.ts | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 config/userColumnsConfig.ts (limited to 'config/userColumnsConfig.ts') diff --git a/config/userColumnsConfig.ts b/config/userColumnsConfig.ts new file mode 100644 index 00000000..c843d235 --- /dev/null +++ b/config/userColumnsConfig.ts @@ -0,0 +1,58 @@ +import { UserView } from "@/db/schema/users"; + +/** + * 테이블/엑셀에 보여줄 컬럼 한 칸을 어떻게 렌더링할지 결정하는 설정 + */ +export interface UserColumnConfig { + /** + * "조인 결과" 객체(UserWithCompanyAndRoles)의 어느 필드를 표시할지 + */ + id: keyof UserView; + + /** 화면·엑셀에서 보여줄 컬럼명 */ + label: string; + + /** (선택) 그룹핑/카테고리 */ + group?: string; + + /** (선택) Excel에서의 헤더 */ + excelHeader?: string; + + /** (선택) 데이터 타입(예: date, string, number 등), 포맷 지정용 */ + type?: string; +} + +/** + * 실제로 "User + Company + Roles" 정보 테이블에서 + * 어떤 컬럼들을 어떤 순서로 표시할 것인지 정의. + */ +export const userColumnsConfig: UserColumnConfig[] = [ + { + id: "user_name", + label: "User Name", + excelHeader: "User Name", + }, + { + id: "user_email", + label: "Email", + excelHeader: "Email", + }, + { + id: "company_name", + label: "Company", + excelHeader: "Company Name", + }, + { + id: "roles", + label: "Roles", + excelHeader: "Roles", + // type: "string[]", // 필요하면 추가 + }, + // 필요 시 createdAt도 조인해서 가져왔다면 아래처럼 추가 + { + id: "created_at", + label: "Created At", + excelHeader: "Created At", + // group: "Metadata", + }, +]; \ No newline at end of file -- cgit v1.2.3