Skip to content

Commit

Permalink
Cwdoe 1270 blank team name fix (#85)
Browse files Browse the repository at this point in the history
* Add Team to signalR entities
  • Loading branch information
sei-tspencer authored Mar 26, 2024
1 parent c4c6029 commit 01aa5fb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Blueprint.Api/Blueprint.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Version>1.0.0-rc2</Version>
<Version>1.0.0-rc3</Version>
<TargetFramework>net6.0</TargetFramework>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>CS1591</NoWarn>
Expand Down
26 changes: 15 additions & 11 deletions Blueprint.Api/Infrastructure/EventHandlers/CiteActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Blueprint.Api.Services;
using Blueprint.Api.Hubs;
using Blueprint.Api.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;

namespace Blueprint.Api.Infrastructure.EventHandlers
{
Expand All @@ -35,24 +36,27 @@ public CiteActionHandler(
_mainHub = mainHub;
}

protected string[] GetGroups(CiteActionEntity CiteActionEntity)
protected string[] GetGroups(CiteActionEntity citeActionEntity)
{
var groupIds = new List<string>();
groupIds.Add(CiteActionEntity.MselId.ToString());
groupIds.Add(citeActionEntity.MselId.ToString());
// the admin data group gets everything
groupIds.Add(MainHub.ADMIN_DATA_GROUP);

return groupIds.ToArray();
}

protected async Task HandleCreateOrUpdate(
CiteActionEntity CiteActionEntity,
CiteActionEntity citeActionEntity,
string method,
string[] modifiedProperties,
CancellationToken cancellationToken)
{
var groupIds = GetGroups(CiteActionEntity);
var CiteAction = _mapper.Map<ViewModels.CiteAction>(CiteActionEntity);
var groupIds = GetGroups(citeActionEntity);
citeActionEntity = await _db.CiteActions
.Include(ca => ca.Team)
.SingleOrDefaultAsync(ca => ca.Id == citeActionEntity.Id, cancellationToken);
var CiteAction = _mapper.Map<ViewModels.CiteAction>(citeActionEntity);
var tasks = new List<Task>();

foreach (var groupId in groupIds)
Expand All @@ -69,8 +73,8 @@ public class CiteActionCreatedSignalRHandler : CiteActionHandler, INotificationH
public CiteActionCreatedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteActionService CiteActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteActionService, mainHub) { }
ICiteActionService citeActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeActionService, mainHub) { }

public async Task Handle(EntityCreated<CiteActionEntity> notification, CancellationToken cancellationToken)
{
Expand All @@ -83,8 +87,8 @@ public class CiteActionUpdatedSignalRHandler : CiteActionHandler, INotificationH
public CiteActionUpdatedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteActionService CiteActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteActionService, mainHub) { }
ICiteActionService citeActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeActionService, mainHub) { }

public async Task Handle(EntityUpdated<CiteActionEntity> notification, CancellationToken cancellationToken)
{
Expand All @@ -101,8 +105,8 @@ public class CiteActionDeletedSignalRHandler : CiteActionHandler, INotificationH
public CiteActionDeletedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteActionService CiteActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteActionService, mainHub)
ICiteActionService citeActionService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeActionService, mainHub)
{
}

Expand Down
33 changes: 19 additions & 14 deletions Blueprint.Api/Infrastructure/EventHandlers/CiteRoleHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,51 @@
using Blueprint.Api.Services;
using Blueprint.Api.Hubs;
using Blueprint.Api.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.CodeAnalysis.VisualBasic.Syntax;

namespace Blueprint.Api.Infrastructure.EventHandlers
{
public class CiteRoleHandler
{
protected readonly BlueprintContext _db;
protected readonly IMapper _mapper;
protected readonly ICiteRoleService _CiteRoleService;
protected readonly ICiteRoleService _citeRoleService;
protected readonly IHubContext<MainHub> _mainHub;

public CiteRoleHandler(
BlueprintContext db,
IMapper mapper,
ICiteRoleService CiteRoleService,
ICiteRoleService citeRoleService,
IHubContext<MainHub> mainHub)
{
_db = db;
_mapper = mapper;
_CiteRoleService = CiteRoleService;
_citeRoleService = citeRoleService;
_mainHub = mainHub;
}

protected string[] GetGroups(CiteRoleEntity CiteRoleEntity)
protected string[] GetGroups(CiteRoleEntity citeRoleEntity)
{
var groupIds = new List<string>();
groupIds.Add(CiteRoleEntity.MselId.ToString());
groupIds.Add(citeRoleEntity.MselId.ToString());
// the admin data group gets everything
groupIds.Add(MainHub.ADMIN_DATA_GROUP);

return groupIds.ToArray();
}

protected async Task HandleCreateOrUpdate(
CiteRoleEntity CiteRoleEntity,
CiteRoleEntity citeRoleEntity,
string method,
string[] modifiedProperties,
CancellationToken cancellationToken)
{
var groupIds = GetGroups(CiteRoleEntity);
var CiteRole = _mapper.Map<ViewModels.CiteRole>(CiteRoleEntity);
var groupIds = GetGroups(citeRoleEntity);
citeRoleEntity = await _db.CiteRoles
.Include(cr => cr.Team)
.SingleOrDefaultAsync(cr => cr.Id == citeRoleEntity.Id, cancellationToken);
var CiteRole = _mapper.Map<ViewModels.CiteRole>(citeRoleEntity);
var tasks = new List<Task>();

foreach (var groupId in groupIds)
Expand All @@ -69,8 +74,8 @@ public class CiteRoleCreatedSignalRHandler : CiteRoleHandler, INotificationHandl
public CiteRoleCreatedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteRoleService CiteRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteRoleService, mainHub) { }
ICiteRoleService citeRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeRoleService, mainHub) { }

public async Task Handle(EntityCreated<CiteRoleEntity> notification, CancellationToken cancellationToken)
{
Expand All @@ -83,8 +88,8 @@ public class CiteRoleUpdatedSignalRHandler : CiteRoleHandler, INotificationHandl
public CiteRoleUpdatedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteRoleService CiteRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteRoleService, mainHub) { }
ICiteRoleService citeRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeRoleService, mainHub) { }

public async Task Handle(EntityUpdated<CiteRoleEntity> notification, CancellationToken cancellationToken)
{
Expand All @@ -101,8 +106,8 @@ public class CiteRoleDeletedSignalRHandler : CiteRoleHandler, INotificationHandl
public CiteRoleDeletedSignalRHandler(
BlueprintContext db,
IMapper mapper,
ICiteRoleService CiteRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, CiteRoleService, mainHub)
ICiteRoleService citeRoleService,
IHubContext<MainHub> mainHub) : base(db, mapper, citeRoleService, mainHub)
{
}

Expand Down
1 change: 1 addition & 0 deletions Blueprint.Api/Services/IntegrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private async void ProcessTheMsel(Object integrationInformationObject)
try
{
var tokenResponse = await ApiClientsExtensions.GetToken(scope);
_logger.LogError($"TokenResponse is " + tokenResponse.AccessToken);
// Get Player API client
currentProcessStep = "Player - get API client";
var playerApiClient = IntegrationPlayerExtensions.GetPlayerApiClient(_httpClientFactory, _clientOptions.CurrentValue.PlayerApiUrl, tokenResponse);
Expand Down

0 comments on commit 01aa5fb

Please sign in to comment.