feat: 대시보드 목록에 생성자 컬럼 추가
This commit is contained in:
parent
64c11d548c
commit
ad0a84f2c3
|
|
@ -231,7 +231,7 @@ export class DashboardService {
|
||||||
|
|
||||||
const whereClause = whereConditions.join(" AND ");
|
const whereClause = whereConditions.join(" AND ");
|
||||||
|
|
||||||
// 대시보드 목록 조회 (users 테이블 조인 제거)
|
// 대시보드 목록 조회 (user_info 조인하여 생성자 이름 포함)
|
||||||
const dashboardQuery = `
|
const dashboardQuery = `
|
||||||
SELECT
|
SELECT
|
||||||
d.id,
|
d.id,
|
||||||
|
|
@ -245,13 +245,16 @@ export class DashboardService {
|
||||||
d.tags,
|
d.tags,
|
||||||
d.category,
|
d.category,
|
||||||
d.view_count,
|
d.view_count,
|
||||||
|
d.company_code,
|
||||||
|
u.user_name as created_by_name,
|
||||||
COUNT(de.id) as elements_count
|
COUNT(de.id) as elements_count
|
||||||
FROM dashboards d
|
FROM dashboards d
|
||||||
LEFT JOIN dashboard_elements de ON d.id = de.dashboard_id
|
LEFT JOIN dashboard_elements de ON d.id = de.dashboard_id
|
||||||
|
LEFT JOIN user_info u ON d.created_by = u.user_id
|
||||||
WHERE ${whereClause}
|
WHERE ${whereClause}
|
||||||
GROUP BY d.id, d.title, d.description, d.thumbnail_url, d.is_public,
|
GROUP BY d.id, d.title, d.description, d.thumbnail_url, d.is_public,
|
||||||
d.created_by, d.created_at, d.updated_at, d.tags, d.category,
|
d.created_by, d.created_at, d.updated_at, d.tags, d.category,
|
||||||
d.view_count
|
d.view_count, d.company_code, u.user_name
|
||||||
ORDER BY d.updated_at DESC
|
ORDER BY d.updated_at DESC
|
||||||
LIMIT $${paramIndex} OFFSET $${paramIndex + 1}
|
LIMIT $${paramIndex} OFFSET $${paramIndex + 1}
|
||||||
`;
|
`;
|
||||||
|
|
@ -280,12 +283,14 @@ export class DashboardService {
|
||||||
thumbnailUrl: row.thumbnail_url,
|
thumbnailUrl: row.thumbnail_url,
|
||||||
isPublic: row.is_public,
|
isPublic: row.is_public,
|
||||||
createdBy: row.created_by,
|
createdBy: row.created_by,
|
||||||
|
createdByName: row.created_by_name || row.created_by,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
updatedAt: row.updated_at,
|
updatedAt: row.updated_at,
|
||||||
tags: JSON.parse(row.tags || "[]"),
|
tags: JSON.parse(row.tags || "[]"),
|
||||||
category: row.category,
|
category: row.category,
|
||||||
viewCount: parseInt(row.view_count || "0"),
|
viewCount: parseInt(row.view_count || "0"),
|
||||||
elementsCount: parseInt(row.elements_count || "0"),
|
elementsCount: parseInt(row.elements_count || "0"),
|
||||||
|
companyCode: row.company_code,
|
||||||
})),
|
})),
|
||||||
pagination: {
|
pagination: {
|
||||||
page,
|
page,
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ export default function DashboardListClient() {
|
||||||
<TableRow className="bg-muted/50 hover:bg-muted/50 border-b">
|
<TableRow className="bg-muted/50 hover:bg-muted/50 border-b">
|
||||||
<TableHead className="h-12 text-sm font-semibold">제목</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">제목</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">설명</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">설명</TableHead>
|
||||||
|
<TableHead className="h-12 text-sm font-semibold">생성자</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">생성일</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">생성일</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">수정일</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">수정일</TableHead>
|
||||||
<TableHead className="h-12 text-right text-sm font-semibold">작업</TableHead>
|
<TableHead className="h-12 text-right text-sm font-semibold">작업</TableHead>
|
||||||
|
|
@ -209,6 +210,9 @@ export default function DashboardListClient() {
|
||||||
<TableCell className="h-16">
|
<TableCell className="h-16">
|
||||||
<div className="bg-muted h-4 animate-pulse rounded"></div>
|
<div className="bg-muted h-4 animate-pulse rounded"></div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell className="h-16">
|
||||||
|
<div className="bg-muted h-4 w-20 animate-pulse rounded"></div>
|
||||||
|
</TableCell>
|
||||||
<TableCell className="h-16">
|
<TableCell className="h-16">
|
||||||
<div className="bg-muted h-4 w-24 animate-pulse rounded"></div>
|
<div className="bg-muted h-4 w-24 animate-pulse rounded"></div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
@ -277,6 +281,7 @@ export default function DashboardListClient() {
|
||||||
<TableRow className="bg-muted/50 hover:bg-muted/50 border-b">
|
<TableRow className="bg-muted/50 hover:bg-muted/50 border-b">
|
||||||
<TableHead className="h-12 text-sm font-semibold">제목</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">제목</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">설명</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">설명</TableHead>
|
||||||
|
<TableHead className="h-12 text-sm font-semibold">생성자</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">생성일</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">생성일</TableHead>
|
||||||
<TableHead className="h-12 text-sm font-semibold">수정일</TableHead>
|
<TableHead className="h-12 text-sm font-semibold">수정일</TableHead>
|
||||||
<TableHead className="h-12 text-right text-sm font-semibold">작업</TableHead>
|
<TableHead className="h-12 text-right text-sm font-semibold">작업</TableHead>
|
||||||
|
|
@ -296,6 +301,9 @@ export default function DashboardListClient() {
|
||||||
<TableCell className="text-muted-foreground h-16 max-w-md truncate text-sm">
|
<TableCell className="text-muted-foreground h-16 max-w-md truncate text-sm">
|
||||||
{dashboard.description || "-"}
|
{dashboard.description || "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell className="text-muted-foreground h-16 text-sm">
|
||||||
|
{dashboard.createdByName || dashboard.createdBy || "-"}
|
||||||
|
</TableCell>
|
||||||
<TableCell className="text-muted-foreground h-16 text-sm">
|
<TableCell className="text-muted-foreground h-16 text-sm">
|
||||||
{formatDate(dashboard.createdAt)}
|
{formatDate(dashboard.createdAt)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
@ -363,6 +371,10 @@ export default function DashboardListClient() {
|
||||||
<span className="text-muted-foreground">설명</span>
|
<span className="text-muted-foreground">설명</span>
|
||||||
<span className="max-w-[200px] truncate font-medium">{dashboard.description || "-"}</span>
|
<span className="max-w-[200px] truncate font-medium">{dashboard.description || "-"}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span className="text-muted-foreground">생성자</span>
|
||||||
|
<span className="font-medium">{dashboard.createdByName || dashboard.createdBy || "-"}</span>
|
||||||
|
</div>
|
||||||
<div className="flex justify-between text-sm">
|
<div className="flex justify-between text-sm">
|
||||||
<span className="text-muted-foreground">생성일</span>
|
<span className="text-muted-foreground">생성일</span>
|
||||||
<span className="font-medium">{formatDate(dashboard.createdAt)}</span>
|
<span className="font-medium">{formatDate(dashboard.createdAt)}</span>
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ export interface Dashboard {
|
||||||
thumbnailUrl?: string;
|
thumbnailUrl?: string;
|
||||||
isPublic: boolean;
|
isPublic: boolean;
|
||||||
createdBy: string;
|
createdBy: string;
|
||||||
|
createdByName?: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
|
@ -97,6 +98,7 @@ export interface Dashboard {
|
||||||
viewCount: number;
|
viewCount: number;
|
||||||
elementsCount?: number;
|
elementsCount?: number;
|
||||||
creatorName?: string;
|
creatorName?: string;
|
||||||
|
companyCode?: string;
|
||||||
elements?: DashboardElement[];
|
elements?: DashboardElement[];
|
||||||
settings?: {
|
settings?: {
|
||||||
resolution?: string;
|
resolution?: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue