24 lines
823 B
C#
24 lines
823 B
C#
using IM_API.Domain.Events;
|
|
using IM_API.Interface.Services;
|
|
using MassTransit;
|
|
|
|
namespace IM_API.Application.EventHandlers.FriendAddHandler
|
|
{
|
|
public class FriendAddConversationHandler : IConsumer<FriendAddEvent>
|
|
{
|
|
private readonly IConversationService _cService;
|
|
public FriendAddConversationHandler(IConversationService cService)
|
|
{
|
|
_cService = cService;
|
|
}
|
|
|
|
public async Task Consume(ConsumeContext<FriendAddEvent> context)
|
|
{
|
|
var @event = context.Message;
|
|
await _cService.MakeConversationAsync(@event.RequestUserId, @event.ResponseUserId, Models.ChatType.PRIVATE);
|
|
await _cService.MakeConversationAsync(@event.ResponseUserId, @event.RequestUserId, Models.ChatType.PRIVATE);
|
|
|
|
}
|
|
}
|
|
}
|