✏️ 프로젝트 이름 인라인 편집 기능 추가
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
백엔드:
- dashboard.py에 PATCH /dashboard/projects/{id} 엔드포인트 추가
- 프로젝트 이름 업데이트 기능 구현
- 활동 로그 기록
프론트엔드:
- ProjectsPage에 인라인 편집 기능 추가
- 더블클릭으로 편집 모드 진입
- Enter 키로 저장, Escape로 취소
- 저장/취소 버튼 (✓/✕) 제공
- 간단하고 직관적인 UX
This commit is contained in:
@@ -425,3 +425,73 @@ async def get_quick_actions(
|
||||
except Exception as e:
|
||||
logger.error(f"Quick actions error: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail=f"빠른 작업 조회 실패: {str(e)}")
|
||||
|
||||
|
||||
@router.patch("/projects/{project_id}")
|
||||
async def update_project_name(
|
||||
project_id: int,
|
||||
job_name: str = Query(..., description="새 프로젝트 이름"),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
프로젝트 이름 수정
|
||||
|
||||
Args:
|
||||
project_id: 프로젝트 ID
|
||||
job_name: 새 프로젝트 이름
|
||||
|
||||
Returns:
|
||||
dict: 수정 결과
|
||||
"""
|
||||
try:
|
||||
# 프로젝트 존재 확인
|
||||
query = text("SELECT * FROM projects WHERE id = :project_id")
|
||||
result = db.execute(query, {"project_id": project_id}).fetchone()
|
||||
|
||||
if not result:
|
||||
raise HTTPException(status_code=404, detail="프로젝트를 찾을 수 없습니다")
|
||||
|
||||
# 프로젝트 이름 업데이트
|
||||
update_query = text("""
|
||||
UPDATE projects
|
||||
SET job_name = :job_name,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = :project_id
|
||||
RETURNING *
|
||||
""")
|
||||
|
||||
updated = db.execute(update_query, {
|
||||
"job_name": job_name,
|
||||
"project_id": project_id
|
||||
}).fetchone()
|
||||
|
||||
db.commit()
|
||||
|
||||
# 활동 로그 기록
|
||||
ActivityLogger.log_activity(
|
||||
db=db,
|
||||
user_id=current_user.get('user_id'),
|
||||
action="UPDATE_PROJECT",
|
||||
target_type="PROJECT",
|
||||
target_id=project_id,
|
||||
details=f"프로젝트 이름 변경: {job_name}"
|
||||
)
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
"message": "프로젝트 이름이 수정되었습니다",
|
||||
"project": {
|
||||
"id": updated.id,
|
||||
"job_no": updated.job_no,
|
||||
"job_name": updated.job_name,
|
||||
"official_project_code": updated.official_project_code
|
||||
}
|
||||
}
|
||||
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
logger.error(f"프로젝트 수정 실패: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail=f"프로젝트 수정 실패: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user