47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
|
|
const { PrismaClient } = require("@prisma/client");
|
||
|
|
const prisma = new PrismaClient();
|
||
|
|
|
||
|
|
async function getComponents() {
|
||
|
|
try {
|
||
|
|
const components = await prisma.component_standards.findMany({
|
||
|
|
where: { is_active: "Y" },
|
||
|
|
select: {
|
||
|
|
component_code: true,
|
||
|
|
component_name: true,
|
||
|
|
category: true,
|
||
|
|
component_config: true,
|
||
|
|
},
|
||
|
|
orderBy: [{ category: "asc" }, { sort_order: "asc" }],
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log("📋 데이터베이스 컴포넌트 목록:");
|
||
|
|
console.log("=".repeat(60));
|
||
|
|
|
||
|
|
const grouped = components.reduce((acc, comp) => {
|
||
|
|
if (!acc[comp.category]) {
|
||
|
|
acc[comp.category] = [];
|
||
|
|
}
|
||
|
|
acc[comp.category].push(comp);
|
||
|
|
return acc;
|
||
|
|
}, {});
|
||
|
|
|
||
|
|
Object.entries(grouped).forEach(([category, comps]) => {
|
||
|
|
console.log(`\n🏷️ ${category.toUpperCase()} 카테고리:`);
|
||
|
|
comps.forEach((comp) => {
|
||
|
|
const type = comp.component_config?.type || "unknown";
|
||
|
|
console.log(
|
||
|
|
` - ${comp.component_code}: ${comp.component_name} (type: ${type})`
|
||
|
|
);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log(`\n총 ${components.length}개 컴포넌트 발견`);
|
||
|
|
} catch (error) {
|
||
|
|
console.error("Error:", error);
|
||
|
|
} finally {
|
||
|
|
await prisma.$disconnect();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
getComponents();
|