Skip to content

Commit 49a4e69

Browse files
committed
Updated to latest Cofoundry and fixed compatibility issues
1 parent 66451f8 commit 49a4e69

File tree

8 files changed

+34
-18
lines changed

8 files changed

+34
-18
lines changed

src/Cofoundry.Plugins.ErrorLogging.Admin/Cofoundry.Plugins.ErrorLogging.Admin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web.Admin" Version="0.2.0-beta0085" />
18+
<PackageReference Include="Cofoundry.Web.Admin" Version="0.2.0-beta0098" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

src/Cofoundry.Plugins.ErrorLogging.Admin/Plugins/Admin/Api/Errors/ErrorsApiController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public async Task<IActionResult> Get([FromQuery] SearchErrorSummariesQuery query
5151
[HttpGet(ID_ROUTE)]
5252
public async Task<IActionResult> Get(int errorId)
5353
{
54-
var result = await _queryExecutor.GetByIdAsync<ErrorDetails>(errorId);
54+
var query = new GetErrorDetailsByIdQuery(errorId);
55+
var result = await _queryExecutor.ExecuteAsync(query);
56+
5557
return _apiResponseHelper.SimpleQueryResponse(this, result);
5658
}
5759

src/Cofoundry.Plugins.ErrorLogging/Bootstrap/ErrorDependencyRegistration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class ErrorDependencyRegistration : IDependencyRegistration
1414
public void Register(IContainerRegister container)
1515
{
1616
container
17-
.RegisterType<IErrorLoggingService, ErrorLoggingService>()
18-
.RegisterType<ErrorLoggingDbContext>()
17+
.Register<IErrorLoggingService, ErrorLoggingService>()
18+
.Register<ErrorLoggingDbContext>()
1919
;
2020
}
2121
}

src/Cofoundry.Plugins.ErrorLogging/Cofoundry.Plugins.ErrorLogging.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web" Version="0.2.0-beta0085" />
18+
<PackageReference Include="Cofoundry.Web" Version="0.2.0-beta0098" />
1919
</ItemGroup>
2020

2121
<ItemGroup>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Cofoundry.Domain.CQS;
6+
7+
namespace Cofoundry.Plugins.ErrorLogging.Domain
8+
{
9+
public class GetErrorDetailsByIdQuery : IQuery<ErrorDetails>
10+
{
11+
public GetErrorDetailsByIdQuery() { }
12+
13+
public GetErrorDetailsByIdQuery(int errorId)
14+
{
15+
ErrorId = errorId;
16+
}
17+
18+
public int ErrorId { get; set; }
19+
}
20+
}

src/Cofoundry.Plugins.ErrorLogging/Domain/Queries/GetErrorDetailsByIdQueryHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace Cofoundry.Plugins.ErrorLogging.Domain
1111
{
1212
public class GetErrorDetailsByIdQueryHandler
13-
: IAsyncQueryHandler<GetByIdQuery<ErrorDetails>, ErrorDetails>
14-
, IPermissionRestrictedQueryHandler<GetByIdQuery<ErrorDetails>, ErrorDetails>
13+
: IAsyncQueryHandler<GetErrorDetailsByIdQuery, ErrorDetails>
14+
, IPermissionRestrictedQueryHandler<GetErrorDetailsByIdQuery, ErrorDetails>
1515
{
1616
private readonly ErrorLoggingDbContext _dbContext;
1717

@@ -22,12 +22,12 @@ ErrorLoggingDbContext dbContext
2222
_dbContext = dbContext;
2323
}
2424

25-
public async Task<ErrorDetails> ExecuteAsync(GetByIdQuery<ErrorDetails> query, IExecutionContext executionContext)
25+
public async Task<ErrorDetails> ExecuteAsync(GetErrorDetailsByIdQuery query, IExecutionContext executionContext)
2626
{
2727
var error = await _dbContext
2828
.Errors
2929
.AsNoTracking()
30-
.Where(u => u.ErrorId == query.Id)
30+
.Where(u => u.ErrorId == query.ErrorId)
3131
.Select(e => new ErrorDetails()
3232
{
3333
CreateDate = e.CreateDate,
@@ -51,7 +51,7 @@ public async Task<ErrorDetails> ExecuteAsync(GetByIdQuery<ErrorDetails> query, I
5151

5252
#region Permission
5353

54-
public IEnumerable<IPermissionApplication> GetPermissions(GetByIdQuery<ErrorDetails> query)
54+
public IEnumerable<IPermissionApplication> GetPermissions(GetErrorDetailsByIdQuery query)
5555
{
5656
yield return new ErrorLogReadPermission();
5757
}

src/Cofoundry.Plugins.ErrorLogging/Install/ErrorLoggingUpdatePackageFactory.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ public override string ModuleIdentifier
1616
}
1717
}
1818

19-
public override IEnumerable<string> DependentModules
20-
{
21-
get
22-
{
23-
yield return CofoundryModuleInfo.ModuleIdentifier;
24-
}
25-
}
19+
public override ICollection<string> DependentModules { get; } = new string[] { CofoundryModuleInfo.ModuleIdentifier };
2620
}
2721
}

src/Cofoundry.Plugins.ErrorLogging/Middleware/ErrorLoggingMiddlewareStartupTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public int Ordering
1313
get { return (int)StartupTaskOrdering.First; }
1414
}
1515

16-
public Type[] RunAfter => new Type[] { typeof(ErrorHandlingMiddlewareConfigurationTask) };
16+
public ICollection<Type> RunAfter => new Type[] { typeof(ErrorHandlingMiddlewareConfigurationTask) };
1717

1818
public void Configure(IApplicationBuilder app)
1919
{

0 commit comments

Comments
 (0)