예제 #1
0
 public SettingsModule(IMapper mapper,
                       IUserNotificationSettingsService settingsService)
     : base(mapper, "notification/settings", false)
 {
     Get("/{userId}", async args => await Fetch <GetUserNotificationSettings, UserNotificationSettings>
             (async x => await settingsService.GetSettingsAsync(x.UserId))
         .MapTo <UserNotificationSettingsDto>()
         .HandleAsync());
 }
예제 #2
0
 public async Task HandleAsync(UsernameChanged @event)
 {
     await _handler
     .Run(async() =>
     {
         var settings            = await _settingsService.GetSettingsAsync(@event.UserId);
         settings.Value.Username = @event.NewName;
         await _settingsService.UpdateSettingsAsync(settings.Value);
     })
     .OnError((ex, logger) => logger.Error(ex, $"Error while updating username, userId: {@event.UserId}"))
     .ExecuteAsync();
 }