using IM_API.Domain.Events; using IM_API.Interface.Services; using MassTransit; namespace IM_API.Application.EventHandlers.GroupJoinHandler { public class GroupJoinDbHandler : IConsumer { private readonly IGroupService _groupService; public GroupJoinDbHandler(IGroupService groupService) { _groupService = groupService; } public async Task Consume(ConsumeContext context) { await _groupService.MakeGroupMemberAsync(context.Message.UserId, context.Message.GroupId, context.Message.IsCreated ? Models.GroupMemberRole.Master : Models.GroupMemberRole.Normal); } } }