+31
-31
@@ -1,31 +1,31 @@
|
||||
using IM_API.Domain.Events;
|
||||
using MassTransit;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestUpdateHandler
|
||||
{
|
||||
public class NextEventHandler : IConsumer<GroupRequestUpdateEvent>
|
||||
{
|
||||
private readonly IPublishEndpoint _endpoint;
|
||||
public NextEventHandler(IPublishEndpoint endpoint)
|
||||
{
|
||||
_endpoint = endpoint;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestUpdateEvent> context)
|
||||
{
|
||||
var @event = context.Message;
|
||||
if(@event.Action == Models.GroupRequestState.Passed)
|
||||
{
|
||||
await _endpoint.Publish(new GroupJoinEvent
|
||||
{
|
||||
AggregateId = @event.AggregateId,
|
||||
OccurredAt = @event.OccurredAt,
|
||||
EventId = Guid.NewGuid(),
|
||||
GroupId = @event.GroupId,
|
||||
OperatorId = @event.OperatorId,
|
||||
UserId = @event.UserId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using IM_API.Domain.Events;
|
||||
using MassTransit;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestUpdateHandler
|
||||
{
|
||||
public class NextEventHandler : IConsumer<GroupRequestUpdateEvent>
|
||||
{
|
||||
private readonly IPublishEndpoint _endpoint;
|
||||
public NextEventHandler(IPublishEndpoint endpoint)
|
||||
{
|
||||
_endpoint = endpoint;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestUpdateEvent> context)
|
||||
{
|
||||
var @event = context.Message;
|
||||
if(@event.Action == Models.GroupRequestState.Passed)
|
||||
{
|
||||
await _endpoint.Publish(new GroupJoinEvent
|
||||
{
|
||||
AggregateId = @event.AggregateId,
|
||||
OccurredAt = @event.OccurredAt,
|
||||
EventId = Guid.NewGuid(),
|
||||
GroupId = @event.GroupId,
|
||||
OperatorId = @event.OperatorId,
|
||||
UserId = @event.UserId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user