feat(project): 댓글 수정 기능 + 달력 드래그 드롭 수정
- 댓글 수정: PUT /api/comments/{id}(본인·관리자), 모달서 인라인 편집(textarea)
- 달력 드래그 드롭이 안 되던 문제 수정: 드롭 대상을 day 셀 대신 주(week)
단위로 받고 마우스 X 로 날짜 칸을 계산. bar 오버레이/pointer-events 간섭
없이 안정적으로 드롭됨. dragover 에서 dropEffect=move 명시.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -813,6 +813,28 @@ async def api_add_comment(
|
||||
return JSONResponse({"comment": comment}, status_code=201)
|
||||
|
||||
|
||||
@router.put("/api/comments/{comment_id}")
|
||||
async def api_update_comment(
|
||||
request: Request, comment_id: int, payload: dict[str, Any] = Body(...)
|
||||
) -> JSONResponse:
|
||||
from app.store import is_admin # noqa: WPS433
|
||||
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
try:
|
||||
comment = st.update_comment(
|
||||
comment_id=comment_id, requester=user["email"],
|
||||
is_admin=is_admin(user), body=payload.get("body", ""),
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="댓글을 찾을 수 없습니다.")
|
||||
except PermissionError as exc:
|
||||
raise HTTPException(status_code=403, detail=str(exc))
|
||||
return JSONResponse({"comment": comment})
|
||||
|
||||
|
||||
@router.delete("/api/comments/{comment_id}")
|
||||
async def api_delete_comment(request: Request, comment_id: int) -> JSONResponse:
|
||||
from app.store import is_admin # noqa: WPS433
|
||||
|
||||
Reference in New Issue
Block a user