-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c924d7
commit 2c141e2
Showing
3 changed files
with
4 additions
and
42 deletions.
There are no files selected for viewing
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
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
16 changes: 4 additions & 12 deletions
16
src/Gameboard.Api/Features/Teams/Notifications/TeamSessionResetNotification.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 |
---|---|---|
@@ -1,26 +1,18 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Gameboard.Api.Services; | ||
using Gameboard.Api.Features.Scores; | ||
using MediatR; | ||
|
||
namespace Gameboard.Api.Features.Teams; | ||
|
||
public record TeamSessionResetNotification(string GameId, string TeamId) : INotification; | ||
|
||
internal class TeamSessionResetHandler : INotificationHandler<TeamSessionResetNotification> | ||
internal class TeamSessionResetHandler(IScoreDenormalizationService scoreDenorm) : INotificationHandler<TeamSessionResetNotification> | ||
{ | ||
private readonly GameService _gameService; | ||
|
||
public TeamSessionResetHandler | ||
( | ||
GameService gameService | ||
) | ||
{ | ||
_gameService = gameService; | ||
} | ||
private readonly IScoreDenormalizationService _scoreDenorm = scoreDenorm; | ||
|
||
public async Task Handle(TeamSessionResetNotification notification, CancellationToken cancellationToken) | ||
{ | ||
await _gameService.ReRank(notification.GameId); | ||
await _scoreDenorm.DenormalizeGame(notification.GameId, cancellationToken); | ||
} | ||
} |