Browse Source

Revert "updates on top of gababus changes for basket signalR"

This reverts commit fe5863b52b.
pull/1207/head
Vijay Bikka 5 years ago
parent
commit
8acd15e05b
9 changed files with 5 additions and 94 deletions
  1. +0
    -3
      src/Services/Basket/Basket.SignalrHub/AutofacModules/ApplicationModule.cs
  2. +2
    -0
      src/Services/Basket/Basket.SignalrHub/Basket.SignalrHub.csproj
  3. +0
    -40
      src/Services/Basket/Basket.SignalrHub/IntegrationEvents/EventHandling/UserAddedCartItemToBasketIntegrationEventHandler.cs
  4. +0
    -27
      src/Services/Basket/Basket.SignalrHub/IntegrationEvents/Events/BasketItem.cs
  5. +0
    -17
      src/Services/Basket/Basket.SignalrHub/IntegrationEvents/Events/UserAddedCartItemToBasketIntegrationEvent.cs
  6. +0
    -3
      src/Services/Basket/Basket.SignalrHub/Startup.cs
  7. +1
    -1
      src/Services/Ordering/Ordering.SignalrHub/Startup.cs
  8. +1
    -2
      src/Web/WebMVC/Startup.cs
  9. +1
    -1
      src/Web/WebSPA/Client/modules/shared/services/security.service.ts

+ 0
- 3
src/Services/Basket/Basket.SignalrHub/AutofacModules/ApplicationModule.cs View File

@ -1,5 +1,4 @@
using Autofac; using Autofac;
using Basket.SignalrHub.IntegrationEvents;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -25,8 +24,6 @@ namespace Basket.SignalrHub.AutofacModules
// builder.RegisterAssemblyTypes(typeof(NewIntegrationEvent).GetTypeInfo().Assembly) // builder.RegisterAssemblyTypes(typeof(NewIntegrationEvent).GetTypeInfo().Assembly)
// .AsClosedTypesOf(typeof(IIntegrationEventHandler<>)); // .AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
builder.RegisterAssemblyTypes(typeof(UserAddedCartItemToBasketIntegrationEvent).GetTypeInfo().Assembly)
.AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
} }
} }
} }

+ 2
- 0
src/Services/Basket/Basket.SignalrHub/Basket.SignalrHub.csproj View File

@ -6,6 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="IntegrationEvents\EventHandling\" />
<Folder Include="IntegrationEvents\Events\" />
<Folder Include="wwwroot\" /> <Folder Include="wwwroot\" />
</ItemGroup> </ItemGroup>


+ 0
- 40
src/Services/Basket/Basket.SignalrHub/IntegrationEvents/EventHandling/UserAddedCartItemToBasketIntegrationEventHandler.cs View File

@ -1,40 +0,0 @@
using Microsoft.AspNetCore.SignalR;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Basket.SignalrHub.IntegrationEvents;
using Serilog.Context;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Basket.SignalrHub.IntegrationEvents.EventHandling
{
public class UserAddedCartItemToBasketIntegrationEventHandler :
IIntegrationEventHandler<UserAddedCartItemToBasketIntegrationEvent>
{
private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<UserAddedCartItemToBasketIntegrationEventHandler> _logger;
public UserAddedCartItemToBasketIntegrationEventHandler(
IHubContext<NotificationsHub> hubContext,
ILogger<UserAddedCartItemToBasketIntegrationEventHandler> logger)
{
_hubContext = hubContext ?? throw new ArgumentNullException(nameof(hubContext));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task Handle(UserAddedCartItemToBasketIntegrationEvent @event)
{
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
{
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
await _hubContext.Clients
.Group(@event.BuyerName)
.SendAsync("UpdateBasketCount", "test message");
}
}
}
}

+ 0
- 27
src/Services/Basket/Basket.SignalrHub/IntegrationEvents/Events/BasketItem.cs View File

@ -1,27 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Basket.SignalrHub.IntegrationEvents
{
public class BasketItem : IValidatableObject
{
public string Id { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var results = new List<ValidationResult>();
if (Quantity < 1)
{
results.Add(new ValidationResult("Invalid number of units", new []{ "Quantity" }));
}
return results;
}
}
}

+ 0
- 17
src/Services/Basket/Basket.SignalrHub/IntegrationEvents/Events/UserAddedCartItemToBasketIntegrationEvent.cs View File

@ -1,17 +0,0 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
namespace Basket.SignalrHub.IntegrationEvents
{
public class UserAddedCartItemToBasketIntegrationEvent : IntegrationEvent
{
public string BuyerName { get; set; }
public BasketItem Item { get; set; }
public UserAddedCartItemToBasketIntegrationEvent(string buyerName, BasketItem basketItem)
{
BuyerName = buyerName;
Item = basketItem;
}
}
}

+ 0
- 3
src/Services/Basket/Basket.SignalrHub/Startup.cs View File

@ -17,8 +17,6 @@ using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks;
using Basket.SignalrHub.AutofacModules; using Basket.SignalrHub.AutofacModules;
using Basket.SignalrHub.IntegrationEvents;
using Basket.SignalrHub.IntegrationEvents.EventHandling;
namespace Basket.SignalrHub namespace Basket.SignalrHub
{ {
@ -162,7 +160,6 @@ namespace Basket.SignalrHub
// Event bus subscribe events goes here // Event bus subscribe events goes here
// eventBus.Subscribe<NewIntegrationEvent, NewIntegrationEventHandler>(); // eventBus.Subscribe<NewIntegrationEvent, NewIntegrationEventHandler>();
eventBus.Subscribe<UserAddedCartItemToBasketIntegrationEvent, UserAddedCartItemToBasketIntegrationEventHandler>();
} }
private void ConfigureAuthService(IServiceCollection services) private void ConfigureAuthService(IServiceCollection services)


+ 1
- 1
src/Services/Ordering/Ordering.SignalrHub/Startup.cs View File

@ -167,7 +167,7 @@ namespace Ordering.SignalrHub
eventBus.Subscribe<OrderStatusChangedToShippedIntegrationEvent, OrderStatusChangedToShippedIntegrationEventHandler>(); eventBus.Subscribe<OrderStatusChangedToShippedIntegrationEvent, OrderStatusChangedToShippedIntegrationEventHandler>();
eventBus.Subscribe<OrderStatusChangedToCancelledIntegrationEvent, OrderStatusChangedToCancelledIntegrationEventHandler>(); eventBus.Subscribe<OrderStatusChangedToCancelledIntegrationEvent, OrderStatusChangedToCancelledIntegrationEventHandler>();
eventBus.Subscribe<OrderStatusChangedToSubmittedIntegrationEvent, OrderStatusChangedToSubmittedIntegrationEventHandler>(); eventBus.Subscribe<OrderStatusChangedToSubmittedIntegrationEvent, OrderStatusChangedToSubmittedIntegrationEventHandler>();
//eventBus.Subscribe<UserAddedCartItemToBasketIntegrationEvent, UserAddedCartItemToBasketIntegrationEventHandler>();
eventBus.Subscribe<UserAddedCartItemToBasketIntegrationEvent, UserAddedCartItemToBasketIntegrationEventHandler>();
} }
private void ConfigureAuthService(IServiceCollection services) private void ConfigureAuthService(IServiceCollection services)


+ 1
- 2
src/Web/WebMVC/Startup.cs View File

@ -266,8 +266,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
options.Scope.Add("marketing"); options.Scope.Add("marketing");
options.Scope.Add("locations"); options.Scope.Add("locations");
options.Scope.Add("webshoppingagg"); options.Scope.Add("webshoppingagg");
options.Scope.Add("orders.signalrhub");
options.Scope.Add("basket.signalrhub");
options.Scope.Add("orders.signalrhub");
}); });
return services; return services;


+ 1
- 1
src/Web/WebSPA/Client/modules/shared/services/security.service.ts View File

@ -81,7 +81,7 @@ export class SecurityService {
let client_id = 'js'; let client_id = 'js';
let redirect_uri = location.origin + '/'; let redirect_uri = location.origin + '/';
let response_type = 'id_token token'; let response_type = 'id_token token';
let scope = 'openid profile orders basket marketing locations webshoppingagg orders.signalrhub basket.signalrhub';
let scope = 'openid profile orders basket marketing locations webshoppingagg orders.signalrhub';
let nonce = 'N' + Math.random() + '' + Date.now(); let nonce = 'N' + Math.random() + '' + Date.now();
let state = Date.now() + '' + Math.random(); let state = Date.now() + '' + Math.random();


Loading…
Cancel
Save