MCPcopy Create free account
hub / github.com/GmpABR/NexusFlow / CreateComment

Method CreateComment

backend/Controllers/TasksController.cs:202–222  ·  view source on GitHub ↗
(int taskId, [FromBody] AddCommentDto dto)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

AddCommentAsyncMethod · 0.45
GetTaskByIdAsyncMethod · 0.45

Tested by

no test coverage detected