Skip to content

Commit 6ab1530

Browse files
Merge pull request #2481 from RocketSurgeonsGuild/renovate/rocket-surgery-extensions
Update Rocket Surgery Extensions to 13.0.0-beta.36
2 parents 8a1a507 + 430cf4f commit 6ab1530

File tree

260 files changed

+8480
-11631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+8480
-11631
lines changed

.github/workflows/close-milestone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
default-label: ':sparkles: mysterious'
7777
github-token: '${{ secrets.GITHUB_TOKEN }}'
7878
- name: 📲 Install GitReleaseManager
79-
uses: gittools/actions/gitreleasemanager/[email protected].2
79+
uses: gittools/actions/gitreleasemanager/[email protected].1
8080
with:
8181
versionSpec: '0.18.0'
8282
- name: Get Repo and Owner

Directory.Packages.props

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<PackageVersion Include="Serilog.Sinks.Spectre" Version="0.5.0" />
3939
<PackageVersion Include="Serilog.Sinks.Trace" Version="4.0.0" />
4040
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="7.2.0" />
41+
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
4142
<PackageVersion Include="xunit.analyzers" Version="1.19.0" />
4243
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
4344
<PackageVersion Include="JetBrains.dotCover.CommandLineTools" Version="2024.3.3" />
@@ -120,8 +121,8 @@
120121
<PackageVersion Include="Rocket.Surgery.Conventions.DryIoc" Version="14.0.1-beta.45" />
121122
<PackageVersion Include="Rocket.Surgery.Conventions.Serilog" Version="14.0.1-beta.45" />
122123
<PackageVersion Include="Rocket.Surgery.CommandLine" Version="14.0.1-beta.45" />
123-
<PackageVersion Include="Rocket.Surgery.DependencyInjection.Extensions" Version="13.0.0-beta.34" />
124-
<PackageVersion Include="Rocket.Surgery.Extensions" Version="13.0.0-beta.34" />
124+
<PackageVersion Include="Rocket.Surgery.DependencyInjection.Extensions" Version="13.0.0-beta.36" />
125+
<PackageVersion Include="Rocket.Surgery.Extensions" Version="13.0.0-beta.36" />
125126
<PackageVersion Include="Rocket.Surgery.Hosting" Version="14.0.1-beta.45" />
126127
<PackageVersion Include="Rocket.Surgery.WebAssembly.Hosting" Version="14.0.1-beta.45" />
127128
<PackageVersion Include="Scrutor" Version="5.1.1" />

sample/Sample.BlazorServer/Program.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@
3434

3535
await app.RunAsync();
3636

37-
public partial class Program;
37+
namespace Sample.BlazorServer
38+
{
39+
public partial class Program;
40+
}

sample/Sample.BlazorWasm/Program.cs

+33-30
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,46 @@
1313

1414
await ( await builder.ConfigureRocketSurgery() ).RunAsync();
1515

16-
public static class TestHandler
16+
namespace Sample.BlazorWasm
1717
{
18-
public record Request : IRequest<Response>
18+
public static class TestHandler
1919
{
20-
public string FirstName { get; set; } = null!;
21-
public string LastName { get; set; } = null!;
22-
}
20+
public record Request : IRequest<Response>
21+
{
22+
public string FirstName { get; set; } = null!;
23+
public string LastName { get; set; } = null!;
24+
}
2325

24-
public record Response(string FullName);
26+
public record Response(string FullName);
2527

26-
[UsedImplicitly]
27-
private class RequestValidator : AbstractValidator<Request>
28-
{
29-
public RequestValidator()
28+
[UsedImplicitly]
29+
private class RequestValidator : AbstractValidator<Request>
3030
{
31-
RuleFor(x => x.FirstName)
32-
.NotEmpty()
33-
.MinimumLength(1)
34-
.MaximumLength(20);
35-
RuleFor(x => x.LastName)
36-
.NotEmpty()
37-
.MinimumLength(1)
38-
.MaximumLength(50);
31+
public RequestValidator()
32+
{
33+
RuleFor(x => x.FirstName)
34+
.NotEmpty()
35+
.MinimumLength(1)
36+
.MaximumLength(20);
37+
RuleFor(x => x.LastName)
38+
.NotEmpty()
39+
.MinimumLength(1)
40+
.MaximumLength(50);
41+
}
3942
}
40-
}
4143

42-
[UsedImplicitly]
43-
private class ResponseValidator : AbstractValidator<Response>
44-
{
45-
public ResponseValidator() => RuleFor(z => z.FullName).NotEmpty();
46-
}
44+
[UsedImplicitly]
45+
private class ResponseValidator : AbstractValidator<Response>
46+
{
47+
public ResponseValidator() => RuleFor(z => z.FullName).NotEmpty();
48+
}
4749

48-
[UsedImplicitly]
49-
private class Handler : IRequestHandler<Request, Response>
50-
{
51-
public Task<Response> Handle(Request request, CancellationToken cancellationToken) => Task.FromResult(
52-
new Response(request.FirstName + " " + request.LastName)
53-
);
50+
[UsedImplicitly]
51+
private class Handler : IRequestHandler<Request, Response>
52+
{
53+
public Task<Response> Handle(Request request, CancellationToken cancellationToken) => Task.FromResult(
54+
new Response(request.FirstName + " " + request.LastName)
55+
);
56+
}
5457
}
5558
}

sample/Sample.Classic.Restful/Program.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@
2424

2525
await app.RunAsync();
2626

27-
public partial class Program;
27+
namespace Sample.Classic.Restful
28+
{
29+
public partial class Program;
30+
}

sample/Sample.Command/Program.cs

+25-20
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Rocket.Surgery.Conventions;
99
using Rocket.Surgery.Hosting;
1010

11+
using Sample.Command;
12+
1113
using Spectre.Console.Cli;
1214

1315
var builder = Host.CreateApplicationBuilder(args);
@@ -28,33 +30,36 @@
2830
);
2931
await host.RunAsync();
3032

31-
public class InstanceThing
33+
namespace Sample.Command
3234
{
33-
public string From => "DryIoc";
34-
}
35+
public class InstanceThing
36+
{
37+
public string From => "DryIoc";
38+
}
3539

36-
public class Dump(IConfiguration configuration, ILogger<Dump> logger, InstanceThing instanceThing)
37-
: Command<AppSettings>
38-
{
39-
public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
40+
public class Dump(IConfiguration configuration, ILogger<Dump> logger, InstanceThing instanceThing)
41+
: Command<AppSettings>
4042
{
41-
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
42-
logger.LogInformation(instanceThing.From);
43-
foreach (var item in configuration.AsEnumerable().Reverse())
43+
public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
4444
{
45-
logger.LogInformation("{Key}: {Value}", item.Key, item.Value ?? "");
46-
}
45+
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
46+
logger.LogInformation(instanceThing.From);
47+
foreach (var item in configuration.AsEnumerable().Reverse())
48+
{
49+
logger.LogInformation("{Key}: {Value}", item.Key, item.Value ?? "");
50+
}
4751

48-
return 1;
52+
return 1;
53+
}
4954
}
50-
}
5155

52-
public class DefaultCommand(ILogger<DefaultCommand> logger) : Command<AppSettings>
53-
{
54-
public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
56+
public class DefaultCommand(ILogger<DefaultCommand> logger) : Command<AppSettings>
5557
{
56-
Console.WriteLine("Hello World!");
57-
logger.LogInformation("Test");
58-
return 1;
58+
public override int Execute([NotNull] CommandContext context, [NotNull] AppSettings settings)
59+
{
60+
Console.WriteLine("Hello World!");
61+
logger.LogInformation("Test");
62+
return 1;
63+
}
5964
}
6065
}
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using Riok.Mapperly.Abstractions;
2-
using Rocket.Surgery.LaunchPad.Mapping.Profiles;
1+
using Riok.Mapperly.Abstractions;
2+
using NodaTimeMapper = Rocket.Surgery.LaunchPad.Mapping.NodaTimeMapper;
33

44
namespace Sample.Core.Models;
55

66
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)]
77
[UseStaticMapper(typeof(StandardMapper))]
88
[UseStaticMapper(typeof(NodaTimeMapper))]
9-
internal static partial class ModelMapper { }
9+
internal static partial class ModelMapper { }
+5-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
using Riok.Mapperly.Abstractions;
1+
using Riok.Mapperly.Abstractions;
22

3-
namespace Sample.Core;
3+
namespace Sample.Core.Models;
44

55
[Mapper]
66
internal static partial class StandardMapper
77
{
8-
public static long LongToDouble(double value)
9-
{
10-
return Convert.ToInt64(value);
11-
}
8+
public static long LongToDouble(double value) => Convert.ToInt64(value);
129

13-
public static double DoubleToLong(long value)
14-
{
15-
return Convert.ToDouble(value);
16-
}
17-
}
10+
public static double DoubleToLong(long value) => Convert.ToDouble(value);
11+
}

sample/Sample.Core/Operations/LaunchRecords/CreateLaunchRecord.cs

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
using FluentValidation;
1+
using FluentValidation;
2+
23
using MediatR;
4+
35
using NodaTime;
6+
47
using Riok.Mapperly.Abstractions;
5-
using Rocket.Surgery.LaunchPad.Foundation;
6-
using Rocket.Surgery.LaunchPad.Mapping.Profiles;
8+
9+
using Rocket.Surgery.LaunchPad.Mapping;
10+
using Rocket.Surgery.LaunchPad.Primitives;
11+
712
using Sample.Core.Domain;
813
using Sample.Core.Models;
914

@@ -16,8 +21,6 @@ namespace Sample.Core.Operations.LaunchRecords;
1621
[UseStaticMapper(typeof(StandardMapper))]
1722
public static partial class CreateLaunchRecord
1823
{
19-
private static partial LaunchRecord Map(Request request);
20-
2124
/// <summary>
2225
/// Create a launch record
2326
/// </summary>
@@ -31,12 +34,12 @@ public record Request : IRequest<Response>
3134
/// <summary>
3235
/// The launch partner
3336
/// </summary>
34-
public string? Partner { get; set; } = null!; // TODO: Make generator that can be used to create a writable view model
37+
public string? Partner { get; set; } // TODO: Make generator that can be used to create a writable view model
3538

3639
/// <summary>
3740
/// The launch partners payload
3841
/// </summary>
39-
public string? Payload { get; set; } = null!; // TODO: Make generator that can be used to create a writable view model
42+
public string? Payload { get; set; } // TODO: Make generator that can be used to create a writable view model
4043

4144
/// <summary>
4245
/// The payload weight
@@ -92,9 +95,7 @@ public async Task<Response> Handle(Request request, CancellationToken cancellati
9295
{
9396
var record = Map(request);
9497

95-
var rocket = await dbContext.Rockets.FindAsync(new object[] { request.RocketId, }, cancellationToken);
96-
if (rocket == null) throw new RequestFailedException("Rocket not found!");
97-
98+
var rocket = await dbContext.Rockets.FindAsync([request.RocketId], cancellationToken) ?? throw new RequestFailedException("Rocket not found!");
9899
record.Rocket = rocket;
99100

100101
await dbContext.AddAsync(record, cancellationToken).ConfigureAwait(false);
@@ -106,4 +107,6 @@ public async Task<Response> Handle(Request request, CancellationToken cancellati
106107
};
107108
}
108109
}
109-
}
110+
111+
private static partial LaunchRecord Map(Request request);
112+
}

sample/Sample.Core/Operations/LaunchRecords/DeleteLaunchRecord.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
using FluentValidation;
1+
using FluentValidation;
2+
23
using MediatR;
4+
35
using Riok.Mapperly.Abstractions;
4-
using Rocket.Surgery.LaunchPad.Foundation;
5-
using Rocket.Surgery.LaunchPad.Mapping.Profiles;
6+
7+
using Rocket.Surgery.LaunchPad.Mapping;
8+
using Rocket.Surgery.LaunchPad.Primitives;
9+
610
using Sample.Core.Domain;
711
using Sample.Core.Models;
812

@@ -22,21 +26,17 @@ public record Request(LaunchRecordId Id) : IRequest;
2226
[UsedImplicitly]
2327
private class Validator : AbstractValidator<Request>
2428
{
25-
public Validator()
26-
{
27-
RuleFor(x => x.Id)
28-
.NotEmpty()
29-
.NotNull();
30-
}
29+
public Validator() => RuleFor(x => x.Id)
30+
.NotEmpty()
31+
.NotNull();
3132
}
3233

3334
[UsedImplicitly]
3435
private class Handler(RocketDbContext dbContext) : IRequestHandler<Request>
3536
{
3637
public async Task Handle(Request request, CancellationToken cancellationToken)
3738
{
38-
var rocket = await dbContext.LaunchRecords.FindAsync(new object[] { request.Id, }, cancellationToken);
39-
if (rocket == null) throw new NotFoundException();
39+
var rocket = await dbContext.LaunchRecords.FindAsync([request.Id], cancellationToken) ?? throw new NotFoundException();
4040

4141
// contrived for testing
4242
if (rocket.Id == new LaunchRecordId(new("bad361de-a6d5-425a-9cf6-f9b2dd236be6")))

0 commit comments

Comments
 (0)