(int taskId, [FromBody] AddCommentDto dto)
| 200 | } |
| 201 | |
| 202 | [HttpPost("{taskId}/comments")] |
| 203 | public async Task<IActionResult> CreateComment(int taskId, [FromBody] AddCommentDto dto) |
| 204 | { |
| 205 | try |
| 206 | { |
| 207 | int userId = GetUserId(); |
| 208 | var activity = await _taskService.AddCommentAsync(taskId, dto.Text, userId); |
| 209 | |
| 210 | // Notify clients to append to the activity log directly |
| 211 | // Better yet, just emit TaskUpdated to reload activities on frontend |
| 212 | var task = await _taskService.GetTaskByIdAsync(taskId, userId); |
| 213 | if (task != null) |
| 214 | { |
| 215 | await _hubContext.Clients.Group($"board_{task.BoardId}") |
| 216 | .SendAsync("TaskUpdated", task); |
| 217 | } |
| 218 | |
| 219 | return Ok(activity); |
| 220 | } |
| 221 | catch (UnauthorizedAccessException) { return Forbid(); } |
| 222 | } |
| 223 | |
| 224 | [HttpDelete("activities/{activityId}")] |
| 225 | public async Task<IActionResult> DeleteComment(int activityId) |
nothing calls this directly
no test coverage detected