Skip to content

Commit

Permalink
v1.6.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-nitehawk committed Jun 4, 2024
1 parent 73ececc commit 9f3121c
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 74 deletions.
2 changes: 1 addition & 1 deletion FastEndpoints.TemplatePack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>

<Version>1.5.1</Version>
<Version>1.6.0</Version>

<PackageType>Template</PackageType>
<PackageId>FastEndpoints.TemplatePack</PackageId>
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- add source generator to projects
- use `ProblemDetails` for error responses
- upgrade dependencies to latest
8 changes: 4 additions & 4 deletions templates/integrated/Source/Entities/Member.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ sealed class Member : Entity
public ulong MemberNumber { get; set; }
public DateOnly SignupDate { get; set; }

public string FirstName { get; set; }
public string LastName { get; set; }
public string FirstName { get; init; }
public string LastName { get; init; }
public string Designation { get; set; }
public string Email { get; set; }
public string Email { get; init; }
public DateOnly BirthDay { get; set; }
public string Gender { get; set; }
public string MobileNumber { get; set; }
public string MobileNumber { get; init; }
public Address Address { get; set; }
}
8 changes: 4 additions & 4 deletions templates/integrated/Source/Entities/NotificationTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace Dom;
sealed class NotificationTemplate : IEntity
{
[BsonId]
public string ID { get; set; } //set the template name as id
public string ID { get; init; } //set the template name as id

public string SmsBody { get; set; }
public string EmailSubject { get; set; }
public string EmailBody { get; set; }
public string SmsBody { get; init; }
public string EmailSubject { get; init; }
public string EmailBody { get; init; }

public object GenerateNewID()
=> ID; //because we're setting the ID manually
Expand Down
28 changes: 14 additions & 14 deletions templates/integrated/Source/Features/Members/SignUp/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ sealed class Request
{
//request dto shape is dictated by front-end team

public User UserDetails { get; set; }
public string Email { get; set; }
public string BirthDay { get; set; }
public string Gender { get; set; }
public ContactDetails Contact { get; set; }
public AddressDetails Address { get; set; }
public User UserDetails { get; init; }
public string Email { get; init; }
public string BirthDay { get; init; }
public string Gender { get; init; }
public ContactDetails Contact { get; init; }
public AddressDetails Address { get; init; }

public sealed class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string FirstName { get; init; }
public string LastName { get; init; }
}

public sealed class ContactDetails
{
public string MobileNumber { get; set; }
public string MobileNumber { get; init; }
public bool Whatsapp { get; set; }
public bool Viber { get; set; }
public bool Telegram { get; set; }
}

public sealed class AddressDetails
{
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string ZipCode { get; set; }
public string Street { get; init; }
public string City { get; init; }
public string State { get; init; }
public string ZipCode { get; init; }
}

sealed class Validator : Validator<Request>
internal sealed class Validator : Validator<Request>
{
public Validator()
{
Expand Down
23 changes: 12 additions & 11 deletions templates/integrated/Source/MyProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.SimpleEmailV2" Version="3.7.303.2" />
<PackageReference Include="AWSSDK.SimpleEmailV2" Version="3.7.303.13"/>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3"/>
<PackageReference Include="FastEndpoints" Version="5.25.0" />
<PackageReference Include="FastEndpoints.Security" Version="5.25.0" />
<PackageReference Include="FastEndpoints.Swagger" Version="5.25.0" />
<PackageReference Include="FastEndpoints" Version="5.26.0"/>
<PackageReference Include="FastEndpoints.Generator" Version="5.26.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<PackageReference Include="FastEndpoints.Security" Version="5.26.0"/>
<PackageReference Include="FastEndpoints.Swagger" Version="5.26.0"/>
<PackageReference Include="MessagePack" Version="2.5.140"/>
<PackageReference Include="MongoDB.Entities" Version="23.1.0" />
<PackageReference Include="MongoDB.Entities" Version="23.1.0"/>
</ItemGroup>

<!-- exclude test related code from release build -->
<PropertyGroup>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' != 'Release'">
<PackageReference Include="FakeItEasy" Version="8.2.0" />
<PackageReference Include="FastEndpoints.Testing" Version="5.25.0" />
<PackageReference Include="FakeItEasy" Version="8.2.0"/>
<PackageReference Include="FastEndpoints.Testing" Version="5.26.0"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<Content Update="Tests\xunit.runner.json" TargetPath="xunit.runner.json"/>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace MyProject.Notifications;

public sealed class SendEmailMessage : ICommand
{
public string ToName { get; set; }
public string ToEmail { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public string ToName { get; init; }
public string ToEmail { get; init; }
public string Subject { get; init; }
public string Body { get; init; }
}

sealed class SendEmailMessageHandler(IAmazonSimpleEmailServiceV2 sesClient, IWebHostEnvironment env, IConfiguration cfg) : ICommandHandler<SendEmailMessage>
Expand Down
4 changes: 2 additions & 2 deletions templates/integrated/Source/Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Amazon;
using Amazon.SimpleEmailV2;
using MyProject;
using Dom;
using FastEndpoints.Security;
using MyProject;

var bld = WebApplication.CreateBuilder(args);
bld.Services
.AddAuthenticationJwtBearer(o => o.SigningKey = bld.Configuration["Auth:SigningKey"])
.AddAuthorization()
.AddFastEndpoints()
.AddFastEndpoints(o => o.SourceGeneratorDiscoveredTypes.AddRange(DiscoveredTypes.All))
.AddJobQueues<JobRecord, JobStorageProvider>()
.AddSingleton<IAmazonSimpleEmailServiceV2>(
new AmazonSimpleEmailServiceV2Client(
Expand Down
2 changes: 1 addition & 1 deletion templates/item/Data.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FeatureName;

static class Data
sealed class Data
{

}
4 changes: 2 additions & 2 deletions templates/project/Source/Features/SayHello/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace SayHello;

sealed class Request
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string FirstName { get; init; }
public string LastName { get; init; }

internal sealed class Validator : Validator<Request>
{
Expand Down
7 changes: 4 additions & 3 deletions templates/project/Source/MyProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FastEndpoints" Version="5.25.0" />
<PackageReference Include="FastEndpoints.Security" Version="5.25.0" />
<PackageReference Include="FastEndpoints.Swagger" Version="5.25.0" />
<PackageReference Include="FastEndpoints" Version="5.26.0"/>
<PackageReference Include="FastEndpoints.Generator" Version="5.26.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<PackageReference Include="FastEndpoints.Security" Version="5.26.0"/>
<PackageReference Include="FastEndpoints.Swagger" Version="5.26.0"/>
</ItemGroup>

</Project>
11 changes: 9 additions & 2 deletions templates/project/Source/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using FastEndpoints.Security;
using MyProject;

var bld = WebApplication.CreateBuilder(args);
bld.Services
.AddFastEndpoints()
.AddAuthenticationJwtBearer(s => s.SigningKey = bld.Configuration["Auth:JwtKey"])
.AddAuthorization()
.AddFastEndpoints(o => o.SourceGeneratorDiscoveredTypes.AddRange(DiscoveredTypes.All))
.SwaggerDocument();

var app = bld.Build();
app.UseFastEndpoints()
app.UseAuthentication()
.UseAuthorization()
.UseFastEndpoints(c => c.Errors.UseProblemDetails())
.UseSwaggerGen();
app.Run();

Expand Down
12 changes: 1 addition & 11 deletions templates/project/Source/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
5 changes: 4 additions & 1 deletion templates/project/Source/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Auth": {
"JwtKey": "a long secret string used to sign jwts. usually set via matching environment variable."
}
}
}
6 changes: 3 additions & 3 deletions templates/project/Tests/SayHello/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ public class Tests(App App) : TestBase<App>
[Fact, Priority(1)]
public async Task Invalid_User_Input()
{
var (rsp, res) = await App.Client.POSTAsync<Endpoint, Request, ErrorResponse>(
var (rsp, res) = await App.Client.POSTAsync<Endpoint, Request, ProblemDetails>(
new()
{
FirstName = "x",
LastName = "y"
});

rsp.StatusCode.Should().Be(HttpStatusCode.BadRequest);
res.Errors.Count.Should().Be(2);
res.Errors.Keys.Should().Equal("firstName", "lastName");
res.Errors.Count().Should().Be(2);
res.Errors.Select(e => e.Name).Should().Equal("firstName", "lastName");
}

[Fact, Priority(2)]
Expand Down
14 changes: 7 additions & 7 deletions templates/project/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FastEndpoints.Testing" Version="5.25.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="FastEndpoints.Testing" Version="5.26.0"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Source\MyProject.csproj" />
<ProjectReference Include="..\Source\MyProject.csproj"/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions templates/test/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FastEndpoints.Testing" Version="5.25.0" />
<PackageReference Include="FastEndpoints.Testing" Version="5.26.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

Expand Down

0 comments on commit 9f3121c

Please sign in to comment.