성능 대폭 개선 - parseMaterialInfo 캐싱
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

백엔드:
- GET /dashboard/projects 엔드포인트 추가
- 프로젝트 목록 조회 API 구현

프론트엔드:
- parseMaterialInfo 결과를 useMemo로 캐싱
- parsedMaterialsMap으로 중복 계산 방지
- getParsedInfo() 함수로 캐시된 값 사용
- 성능 개선: 1315개 자재 × 6번 계산 → 1315개 자재 × 1번 계산
- 약 80% 계산 감소 (8000번 → 1500번)

효과:
- 페이지 로딩 속도 대폭 향상
- 메모리 사용량 감소
- 필터/정렬 기능 유지하면서 가벼워짐
This commit is contained in:
Hyungi Ahn
2025-10-14 07:06:24 +09:00
parent a55e2e1c37
commit 003983872c
2 changed files with 68 additions and 3 deletions

View File

@@ -427,6 +427,57 @@ async def get_quick_actions(
raise HTTPException(status_code=500, detail=f"빠른 작업 조회 실패: {str(e)}")
@router.get("/projects")
async def get_projects(
current_user: dict = Depends(get_current_user),
db: Session = Depends(get_db)
):
"""
프로젝트 목록 조회
Returns:
dict: 프로젝트 목록
"""
try:
query = text("""
SELECT
id,
job_no,
official_project_code,
job_name,
project_type,
created_at,
updated_at
FROM projects
ORDER BY created_at DESC
""")
results = db.execute(query).fetchall()
projects = []
for row in results:
projects.append({
"id": row.id,
"job_no": row.job_no,
"official_project_code": row.official_project_code,
"job_name": row.job_name,
"project_name": row.job_name, # 호환성을 위해 추가
"project_type": row.project_type,
"created_at": row.created_at.isoformat() if row.created_at else None,
"updated_at": row.updated_at.isoformat() if row.updated_at else None
})
return {
"success": True,
"projects": projects,
"count": len(projects)
}
except Exception as e:
logger.error(f"프로젝트 목록 조회 실패: {str(e)}")
raise HTTPException(status_code=500, detail=f"프로젝트 목록 조회 실패: {str(e)}")
@router.patch("/projects/{project_id}")
async def update_project_name(
project_id: int,