Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.204
dotnet-version: 10.0.100-rc.2.25502.107
- run: dotnet run --project build/build.csproj
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<AnalysisMode>Recommended</AnalysisMode>
<WarningsAsErrors>true</WarningsAsErrors>
Expand Down
22 changes: 17 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@
<PackageVersion Include="Bullseye" Version="6.0.0" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.13" />
<PackageVersion
Include="Microsoft.AspNetCore.Authentication.JwtBearer"
Version="10.0.0-rc.2.25502.107"
/>
<PackageVersion
Include="Microsoft.EntityFrameworkCore.InMemory"
Version="10.0.0-rc.2.25502.107"
/>
<PackageVersion
Include="Microsoft.EntityFrameworkCore.Sqlite"
Version="10.0.0-rc.2.25502.107"
/>
<PackageVersion
Include="Microsoft.EntityFrameworkCore.SqlServer"
Version="10.0.0-rc.2.25502.107"
/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Serilog" Version="4.3.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="FluentValidation" Version="12.0.0" />
<PackageVersion Include="MediatR" Version="12.5.0" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.4" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="9.0.6" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.


FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet run --project build/build.csproj -- publish

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base

WORKDIR /app
COPY --from=build /src/publish .
Expand Down
4 changes: 2 additions & 2 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RemoveDirectory(string d)
}
);

Target(Build, [Format], () => Run("dotnet", "build . -c Release"));
Target(Build, [Format], () => Run("dotnet", "build Conduit.sln -c Release"));

Target(
Test,
Expand All @@ -67,7 +67,7 @@ void RemoveDirectory(string d)
{
Run(
"dotnet",
$"publish {project} -c Release -f net8.0 -o ./publish --no-restore --no-build --verbosity=normal"
$"publish {project} -c Release -f net10.0 -o ./publish --no-restore --no-build --verbosity=normal"
);
}
);
Expand Down
2 changes: 1 addition & 1 deletion build/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"dependencies": {
"net8.0": {
"net10.0": {
"Bullseye": {
"type": "Direct",
"requested": "[6.0.0, )",
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.201",
"version": "10.0.100-rc.2.25502.107",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion src/Conduit/Domain/Article.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Article

[NotMapped]
public List<string> TagList =>
ArticleTags.Where(x => x.TagId is not null).Select(x => x.TagId!).ToList();
[.. ArticleTags.Where(x => x.TagId is not null).Select(x => x.TagId!)];

[JsonIgnore]
public List<ArticleTag> ArticleTags { get; init; } = new();
Expand Down
2 changes: 1 addition & 1 deletion src/Conduit/Features/Articles/Edit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ CancellationToken cancellationToken

// ensure context is tracking any tags that are about to be created so that it won't attempt to insert a duplicate
context.Tags.AttachRange(
articleTagsToCreate.Where(x => x.Tag is not null).Select(a => a.Tag!).ToArray()
[.. articleTagsToCreate.Where(x => x.Tag is not null).Select(a => a.Tag!)]
);

// add the new article tags
Expand Down
2 changes: 1 addition & 1 deletion src/Conduit/Features/Profiles/IProfileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Conduit.Features.Profiles;

public interface IProfileReader
{
Task<ProfileEnvelope> ReadProfile(string username, CancellationToken cancellationToken);
public Task<ProfileEnvelope> ReadProfile(string username, CancellationToken cancellationToken);
}
14 changes: 6 additions & 8 deletions src/Conduit/Features/Users/Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ public async Task<UserEnvelope> Handle(Command message, CancellationToken cancel
);
}

if (
!person.Hash.SequenceEqual(
await passwordHasher.Hash(
message.User.Password ?? throw new InvalidOperationException(),
person.Salt
)
)
)
var hash = await passwordHasher.Hash(
message.User.Password ?? throw new InvalidOperationException(),
person.Salt
);

if (!person.Hash.SequenceEqual(hash))
{
throw new RestException(
HttpStatusCode.Unauthorized,
Expand Down
14 changes: 4 additions & 10 deletions src/Conduit/Infrastructure/ConduitContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@ public void CommitTransaction()
}
finally
{
if (_currentTransaction != null)
{
_currentTransaction.Dispose();
_currentTransaction = null;
}
_currentTransaction?.Dispose();
_currentTransaction = null;
}
}

Expand All @@ -114,11 +111,8 @@ public void RollbackTransaction()
}
finally
{
if (_currentTransaction != null)
{
_currentTransaction.Dispose();
_currentTransaction = null;
}
_currentTransaction?.Dispose();
_currentTransaction = null;
}
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Conduit/Infrastructure/ICurrentUserAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace Conduit.Infrastructure;

public interface ICurrentUserAccessor
{
string? GetCurrentUsername();
public string? GetCurrentUsername();
}
2 changes: 1 addition & 1 deletion src/Conduit/Infrastructure/Security/IJwtTokenGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace Conduit.Infrastructure.Security;

public interface IJwtTokenGenerator
{
string CreateToken(string username);
public string CreateToken(string username);
}
2 changes: 1 addition & 1 deletion src/Conduit/Infrastructure/Security/IPasswordHasher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Conduit.Infrastructure.Security;

public interface IPasswordHasher : IDisposable
{
Task<byte[]> Hash(string password, byte[] salt);
public Task<byte[]> Hash(string password, byte[] salt);
}
2 changes: 1 addition & 1 deletion src/Conduit/Infrastructure/ValidationPipelineBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IEnumerable<IValidator<TRequest>> validators
) : IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
{
private readonly List<IValidator<TRequest>> _validators = validators.ToList();
private readonly List<IValidator<TRequest>> _validators = [.. validators];

public async Task<TResponse> Handle(
TRequest request,
Expand Down
5 changes: 1 addition & 4 deletions src/Conduit/Infrastructure/ValidatorActionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public void OnActionExecuting(ActionExecutingContext filterContext)

foreach (var valuePair in filterContext.ModelState)
{
errors.Add(
valuePair.Key,
valuePair.Value.Errors.Select(x => x.ErrorMessage).ToArray()
);
errors.Add(valuePair.Key, [.. valuePair.Value.Errors.Select(x => x.ErrorMessage)]);
}

var content = JsonSerializer.Serialize(new { errors });
Expand Down
2 changes: 1 addition & 1 deletion src/Conduit/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
.Services.AddMvc(opt =>
{
opt.Conventions.Add(new GroupByApiRootConvention());
opt.Filters.Add(typeof(ValidatorActionFilter));
opt.Filters.Add<ValidatorActionFilter>();
opt.EnableEndpointRouting = false;
})
.AddJsonOptions(opt =>
Expand Down
Loading