-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added judge update handler with no notification
- Loading branch information
1 parent
95b1e2c
commit 5912f53
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...gQueueSubscriber.Services/IntegrationEvents/JudgeUpdatedNoNotificationIntegrationEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace BookingQueueSubscriber.Services.IntegrationEvents | ||
{ | ||
public class JudgeUpdatedNoNotificationIntegrationEvent : IIntegrationEvent | ||
{ | ||
public HearingDto Hearing { get; set; } | ||
public ParticipantDto Judge { get; set; } | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...iber/BookingQueueSubscriber.Services/MessageHandlers/JudgeUpdatedNoNotificationHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using BookingQueueSubscriber.Services.Mappers; | ||
using BookingQueueSubscriber.Services.VideoApi; | ||
|
||
namespace BookingQueueSubscriber.Services.MessageHandlers | ||
{ | ||
public class JudgeUpdatedNoNotificationHandler : IMessageHandler<JudgeUpdatedNoNotificationIntegrationEvent> | ||
{ | ||
private readonly IVideoApiService _apiService; | ||
private readonly ILogger _logger; | ||
|
||
public JudgeUpdatedNoNotificationHandler(IVideoApiService apiService, ILogger logger) | ||
{ | ||
_logger = logger; | ||
_apiService = apiService; | ||
} | ||
|
||
public async Task HandleAsync(JudgeUpdatedNoNotificationIntegrationEvent eventMessage) | ||
{ | ||
var conferenceResponse = await _apiService.GetConferenceByHearingRefId(eventMessage.Hearing.HearingId, true); | ||
var judgeResponse = conferenceResponse.Participants.SingleOrDefault(x => x.RefId == eventMessage.Judge.ParticipantId); | ||
|
||
if (judgeResponse != null) | ||
{ | ||
var request = ParticipantToUpdateParticipantMapper.MapToParticipantRequest(eventMessage.Judge); | ||
await _apiService.UpdateParticipantDetails(conferenceResponse.Id, judgeResponse.Id, request); | ||
} | ||
else | ||
_logger.LogError("Unable to find judge participant by ref id {ParticipantRefId} in {ConferenceId}", eventMessage.Judge.ParticipantId, conferenceResponse.Id); | ||
} | ||
|
||
|
||
async Task IMessageHandler.HandleAsync(object integrationEvent) => await HandleAsync((JudgeUpdatedNoNotificationIntegrationEvent)integrationEvent); | ||
|
||
} | ||
} |