Skip to content

Commit

Permalink
feat: update to bit 8.6.0 #37 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Dec 31, 2023
1 parent cf93b60 commit 8c082b7
Show file tree
Hide file tree
Showing 76 changed files with 1,771 additions and 1,708 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bit.TemplatePlayground CD
# https://bitplatform.dev/templates/dev-ops

env:
API_SERVER_ADDRESS: 'https://bp.bitplatform.dev/api/'
API_SERVER_ADDRESS: 'https://bp.bitplatform.dev/'
APP_SERVICE_NAME: 'app-service-bp-test'
IOS_CODE_SIGN_PROVISION: 'Bit.TemplatePlayground'

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Done!

This sample project gets created by the following command:
```bash
dotnet new install Bit.Boilerplate && dotnet new bit-bp --name Bit.TemplatePlayground --database sqlite --sample adminpanel
dotnet new install Bit.Boilerplate && dotnet new bit-bp --name Bit.TemplatePlayground --database sqlite --sample admin
```

Note: In order to view sign-up's `confirmation email`, read [Email settings docs](https://bitplatform.dev/templates/settings).
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.5.0" />
<PackageReference Include="Bit.CodeAnalyzers" Version="8.5.0">
<PackageReference Include="Bit.CodeAnalyzers" Version="8.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Bit.SourceGenerators" Version="8.5.0">
<PackageReference Include="Bit.SourceGenerators" Version="8.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
1 change: 1 addition & 0 deletions src/Bit.TemplatePlayground.Server/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
{
<Script src="_framework/blazor.web.js"></Script>
}
<Script src="_content/Bit.Butil/bit-butil.js"></Script>
<Script src="_content/Bit.BlazorUI/scripts/bit.blazorui.js"></Script>
<Script src="_content/Bit.TemplatePlayground.Client.Core/scripts/app.js"></Script>
<Script src="_content/Bit.BlazorUI.Extras/scripts/bit.blazorui.extras.js"></Script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task<PagedResult<CategoryDto>> GetCategories(ODataQueryOptions<Cate
if (odataQuery.Top is not null)
query = query.Take(odataQuery.Top.Value);

return new PagedResult<CategoryDto>(query.AsAsyncEnumerable(), totalCount);
return new PagedResult<CategoryDto>(await query.ToArrayAsync(cancellationToken), totalCount);
}

[HttpGet("{id}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ private async Task SendConfirmationEmail(SendConfirmationEmailRequestDto sendCon

var controller = RouteData.Values["controller"]!.ToString();

var confirmationLink = Url.Action(nameof(ConfirmEmail), controller,
new { user.Email, token },
HttpContext.Request.Scheme);
var confirmationLink = new Uri(HttpContext.Request.GetBaseUrl(), $"email-confirmation?email={HttpUtility.UrlEncode(user.Email)}&token={HttpUtility.UrlEncode(token)}");

var body = await htmlRenderer.Dispatcher.InvokeAsync(async () =>
{
Expand Down Expand Up @@ -127,28 +125,22 @@ private async Task SendConfirmationEmail(SendConfirmationEmailRequestDto sendCon
throw new ResourceValidationException(result.ErrorMessages.Select(err => Localizer[err]).ToArray());
}

[HttpGet]
public async Task<ActionResult> ConfirmEmail(string email, string token)
[HttpPost]
public async Task ConfirmEmail(ConfirmEmailRequestDto body)
{
var user = await userManager.FindByEmailAsync(email);
var user = await userManager.FindByEmailAsync(body.Email!);

if (user is null)
throw new BadRequestException(Localizer.GetString(nameof(AppStrings.UserNameNotFound), email));
throw new BadRequestException(Localizer.GetString(nameof(AppStrings.UserNameNotFound), body.Email!));

var emailConfirmed = user.EmailConfirmed;
var errors = string.Empty;

if (emailConfirmed is false)
{
var result = await userManager.ConfirmEmailAsync(user, token);
var result = await userManager.ConfirmEmailAsync(user, body.Token!);
if (!result.Succeeded)
errors = string.Join(", ", result.Errors.Select(e => $"{e.Code}: {e.Description}"));
emailConfirmed = result.Succeeded;
throw new ResourceValidationException(result.Errors.Select(e => new LocalizedString(e.Code, e.Description)).ToArray());
}

string url = $"/email-confirmation?email={email}&email-confirmed={emailConfirmed}{(string.IsNullOrEmpty(errors) ? "" : ($"&error={errors}"))}";

return Redirect(url);
}

[HttpPost, ProducesResponseType<TokenResponseDto>(statusCode: 200)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task<PagedResult<ProductDto>> GetProducts(ODataQueryOptions<Product
if (odataQuery.Top is not null)
query = query.Take(odataQuery.Top.Value);

return new PagedResult<ProductDto>(query.AsAsyncEnumerable(), totalCount);
return new PagedResult<ProductDto>(await query.ToArrayAsync(cancellationToken), totalCount);
}

[HttpGet("{id}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class ProductConfiguration : IEntityTypeConfiguration<Product>
{
public void Configure(EntityTypeBuilder<Product> builder)
{
DateTime baseDate = DateTime.Parse("2023-12-14");
DateTime baseDate = DateTime.Parse("2023-12-31");

builder.HasData(
new() { Id = 1, Name = "Mustang", Price = 27155, Description = "The Ford Mustang is ranked #1 in Sports Cars", CreatedOn = baseDate.AddDays(-10), CategoryId = 1 },
Expand Down
Loading

0 comments on commit 8c082b7

Please sign in to comment.