Endpoint
Request Body
The ID of the comment to update.
The new text content for the comment.
Response
Returns
"Worked!" when the comment is updated successfully.Returns
"Invalid!" if the operation fails (e.g., comment not found).Example Request
Response Example
Error Response
Behavior Notes
Updating a comment does not change its
created_at timestamp. There is no updated_at field in the comment schema.This operation does not affect the task’s
amount_of_comments counter.After successfully updating a comment, emit a
database-change event via Socket.io to notify other clients. See Real-time Updates for details.Database Operation
The endpoint performs the following Prisma update:Common Use Cases
Fix Typo in Comment
Add Timestamp to Existing Comment
Redact Sensitive Information
Getting Comment ID
To update a comment, you need its ID. Since there’s no dedicated endpoint to fetch comments, you’ll need to query them directly:Edit History
If you need edit history, consider:- Appending “(edited)” to the comment text
- Including edit timestamps in the comment text
- Extending the schema to add
updated_atandedit_historyfields
Related Endpoints
- Add Comment - Create a new comment
- Delete Comment - Remove a comment
Source Reference
Implementation:src/routes/api/(comments)/updateCommentFromTask/+server.ts:5