feat: Add drawing annotation functionality to comments, including a new canvas component and API integration for creation, retrieval, and updates.

This commit is contained in:
Yusuf İpek
2026-02-21 20:23:15 +03:00
parent 4cb4089caa
commit d731c9434a
6 changed files with 424 additions and 16 deletions
+3 -2
View File
@@ -176,10 +176,10 @@ export async function PATCH(request: NextRequest, { params }: RouteParams) {
}
const body = await request.json();
const { content, isResolved, tagId } = body;
const { content, isResolved, tagId, annotationData } = body;
// Only author can edit content or tag
if ((content !== undefined || tagId !== undefined) && !isAuthor) {
if ((content !== undefined || tagId !== undefined || annotationData !== undefined) && !isAuthor) {
return apiErrors.forbidden('Only the author can edit comment content');
}
@@ -191,6 +191,7 @@ export async function PATCH(request: NextRequest, { params }: RouteParams) {
const updateData: Record<string, unknown> = {};
if (content !== undefined && typeof content === 'string') updateData.content = content.trim();
if (tagId !== undefined) updateData.tagId = tagId;
if (annotationData !== undefined) updateData.annotationData = annotationData;
if (isResolved !== undefined) {
updateData.isResolved = isResolved;
updateData.resolvedAt = isResolved ? new Date() : null;