We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd60604 commit 3e897b5Copy full SHA for 3e897b5
Features/Messages/Commands/SendMessageCommandHandler.cs
@@ -42,6 +42,22 @@ public SendMessageCommandHandler(
42
43
public async Task<ApiResponse<Message>> Handle(SendMessageCommand request, CancellationToken cancellationToken)
44
{
45
- throw new NotImplementedException();
+ try
46
+ {
47
+ var message = new Message
48
49
+ ChannelId = request.ChannelId,
50
+ SenderId = _currentUser.Id,
51
+ Content = request.Content?.Trim()
52
+ };
53
+ _messageWriteRepository.AddAsync(message);
54
+ _messageWriteRepository.CommitAsync();
55
+
56
+ return ApiResponse<Message>.Success(message);
57
+ }
58
+ catch (Exception e)
59
60
+ return ApiResponse<Message>.InternalServerError();
61
62
}
63
0 commit comments