Skip to content

Commit

Permalink
Removed commented out code and fixed warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmackay committed Nov 21, 2023
1 parent 90a8cb2 commit b5f2c2e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public CreateCustomerCommandValidator()
RuleFor(x => x.CompanyName).MaximumLength(40).NotEmpty();
RuleFor(x => x.ContactName).MaximumLength(30);
RuleFor(x => x.ContactTitle).MaximumLength(30);
//RuleFor(x => x.Country).MaximumLength(15);
//RuleFor(x => x.Fax).MaximumLength(24);
//RuleFor(x => x.Phone).MaximumLength(24);
RuleFor(x => x.PostalCode).NotEmpty();
RuleFor(x => x.Region).MaximumLength(15);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,8 @@ public UpdateCustomerCommandValidator()
RuleFor(x => x.CompanyName).MaximumLength(40).NotEmpty();
RuleFor(x => x.ContactName).MaximumLength(30);
RuleFor(x => x.ContactTitle).MaximumLength(30);
//RuleFor(x => x.Country).MaximumLength(15);
RuleFor(x => x.Fax).NotEmpty();
RuleFor(x => x.Phone).NotEmpty();
//RuleFor(x => x.PostalCode).MaximumLength(10);
RuleFor(x => x.Region).MaximumLength(15);

// RuleFor(c => c.PostalCode).Matches(@"^\d{4}$")
// .When(c => c.Country == "Australia")
// .WithMessage("Australian Postcodes have 4 digits");
//
// RuleFor(c => c.Phone)
// .Must(HaveQueenslandLandLine)
// .When(c => c.Country == "Australia" && c.PostalCode.StartsWith("4"))
// .WithMessage("Customers in QLD require at least one QLD landline.");
}

// private static bool HaveQueenslandLandLine(UpdateCustomerCommand model, string phoneValue)
// {
// return model.Phone.StartsWith("07") || model.Fax.StartsWith("07");
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace Northwind.Application.Customers.EventHandlers;

// ReSharper disable once UnusedType.Global
public class CustomerCreatedHandler(INotificationService notification) : INotificationHandler<CustomerCreatedEvent>
public class CustomerCreatedHandler(INotificationService notificationService) : INotificationHandler<CustomerCreatedEvent>
{
public async Task Handle(CustomerCreatedEvent evt, CancellationToken cancellationToken)
public async Task Handle(CustomerCreatedEvent notification, CancellationToken cancellationToken)
{
// Publish notification to external service so welcome email can be sent
await notification.SendAsync(new MessageDto("From", "To", "Subject - Welcome to Northwind365", "Body"));
await notificationService.SendAsync(new MessageDto("From", "To", "Subject - Welcome to Northwind365", "Body"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ internal static void BuildAction(ComplexPropertyBuilder<Address> addressBuilder)
{
addressBuilder.Property(m => m.Line1).HasMaxLength(60);
addressBuilder.Property(m => m.City).HasMaxLength(50);
//addressBuilder.Property(m => m.PostalCode).HasMaxLength(10);
addressBuilder.Property(m => m.Region).HasMaxLength(100);
//addressBuilder.Property(m => m.Country).HasMaxLength(100);

addressBuilder.ComplexProperty(m => m.PostalCode, builder => builder.Property(m => m.Number).HasMaxLength(10));
addressBuilder.ComplexProperty(m => m.Country, builder => builder.Property(m => m.Name).HasMaxLength(100));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ public void Configure(EntityTypeBuilder<Customer> builder)
builder.Property(e => e.ContactTitle).HasMaxLength(50);

builder.ComplexProperty(e => e.Fax, faxBuilder => faxBuilder.Property(m => m.Number).HasMaxLength(24));
//builder.Property(e => e.Fax).HasMaxLength(24);

builder.ComplexProperty(e => e.Phone, phoneBuilder => phoneBuilder.Property(m => m.Number).HasMaxLength(24));
//builder.Property(e => e.Phone).HasMaxLength(24);

builder.HasMany(e => e.Orders)
.WithOne(p => p.Customer)
Expand Down
18 changes: 9 additions & 9 deletions Src/WebUI/WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@
<_ContentIncludedByDefault Remove="Pages\_ViewStart.cshtml" />
</ItemGroup>

<!-- <Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug'">-->
<!-- <Exec ConsoleToMSBuild="true" ContinueOnError="true" WorkingDirectory="$(ProjectDir)" EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="$(NSwagExe_Net80) run nswag.json /variables:Configuration=$(Configuration)">-->
<!-- <Output TaskParameter="ExitCode" PropertyName="NSwagExitCode" />-->
<!-- <Output TaskParameter="ConsoleOutput" PropertyName="NSwagOutput" />-->
<!-- </Exec>-->

<!-- <Message Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' == '0'" Importance="low" />-->
<!-- <Error Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' != '0'" />-->
<!-- </Target>-->
<Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug'">
<Exec ConsoleToMSBuild="true" ContinueOnError="true" WorkingDirectory="$(ProjectDir)" EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="$(NSwagExe_Net80) run nswag.json /variables:Configuration=$(Configuration)">
<Output TaskParameter="ExitCode" PropertyName="NSwagExitCode" />
<Output TaskParameter="ConsoleOutput" PropertyName="NSwagOutput" />
</Exec>

<Message Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' == '0'" Importance="low" />
<Error Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' != '0'" />
</Target>

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
Expand Down

0 comments on commit b5f2c2e

Please sign in to comment.