Skip to content

Commit

Permalink
feat: update to bit 8.7.5 #45 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Feb 11, 2024
1 parent ebc571f commit 228f098
Show file tree
Hide file tree
Showing 49 changed files with 493 additions and 383 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h
echo A | xcopy .\bin\publish .\publish-result /s /e /h
dotnet tool restore
dotnet vpk pack -u Bit.TemplatePlayground.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Bit.TemplatePlayground.Client.Windows-x64.exe -r win-x64 --framework net8.0.1-x64-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Bit.TemplatePlayground'
dotnet vpk pack -u Bit.TemplatePlayground.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Bit.TemplatePlayground.Client.Windows-x86.exe -r win-x86 --framework net8.0.1-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Bit.TemplatePlayground'
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down
11 changes: 11 additions & 0 deletions Bit.TemplatePlayground.Web.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"solution": {
"path": "Bit.TemplatePlayground.sln",
"projects": [
"src\\Bit.TemplatePlayground.Server\\Bit.TemplatePlayground.Server.csproj",
"src\\Bit.TemplatePlayground.Shared\\Bit.TemplatePlayground.Shared.csproj",
"src\\Client\\Bit.TemplatePlayground.Client.Core\\Bit.TemplatePlayground.Client.Core.csproj",
"src\\Client\\Bit.TemplatePlayground.Client.Web\\Bit.TemplatePlayground.Client.Web.csproj"
]
}
}
2 changes: 2 additions & 0 deletions Bit.TemplatePlayground.sln
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Global
{E3CB3C34-F5DE-4A96-B552-7D52BCAD1E1F} = {248D8229-BABD-4F0A-A9C6-0417B464507B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_NeutralResourcesLanguage = en-US
RESX_CodeReferences = {"Items":[{"Expression":"\\W($File.$Key)\\W","Extensions":".cs,.xaml,.cshtml,.razor","IsCaseSensitive":true,"SingleLineComment":"\/\/"},{"Expression":"\\W($File.$Key)\\W","Extensions":".vbhtml","IsCaseSensitive":false,"SingleLineComment":null},{"Expression":"ResourceManager.GetString\\(\"($Key)\"\\)","Extensions":".cs","IsCaseSensitive":true,"SingleLineComment":"\/\/"},{"Expression":"typeof\\((\\w+\\.)*($File)\\).+\"($Key)\"|\"($Key)\".+typeof\\((\\w+\\.)*($File)\\)","Extensions":".cs","IsCaseSensitive":true,"SingleLineComment":"\/\/"},{"Expression":"\\W($Key)\\W","Extensions":".vb","IsCaseSensitive":false,"SingleLineComment":"'"},{"Expression":"\\W($File::$Key)\\W","Extensions":".cpp,.c,.hxx,.h","IsCaseSensitive":true,"SingleLineComment":"\/\/"},{"Expression":"<%\\$\\s+Resources:\\s*($File)\\s*,\\s*($Key)\\s*%>","Extensions":".aspx,.ascx,.master","IsCaseSensitive":true,"SingleLineComment":null},{"Expression":"StringResourceKey\\.($Key)","Extensions":".cs","IsCaseSensitive":true,"SingleLineComment":"\/\/"},{"Expression":"\\.($Key)","Extensions":".ts,.html","IsCaseSensitive":true,"SingleLineComment":"\/\/"}]}
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal
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.101",
"rollForward": "disable"
"rollForward": "disable"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pulumi.AzureNative" Version="2.26.0" />
<PackageReference Include="Pulumi.AzureNative" Version="2.27.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,37 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.5.0" />
<PackageReference Include="Bit.CodeAnalyzers" Version="8.7.4">
<PackageReference Include="Bit.CodeAnalyzers" Version="8.7.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Bit.SourceGenerators" Version="8.7.4">
<PackageReference Include="Bit.SourceGenerators" Version="8.7.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentEmail.Smtp" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.Extensions.Options" />
<Using Include="Microsoft.AspNetCore.Authorization" />
<Using Include="Bit.TemplatePlayground.Shared.Enums" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.5.0" />
<PackageReference Include="FluentEmail.Smtp" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.1" />

<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -43,22 +49,22 @@
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="8.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Network" Version="8.0.0" />
<PackageReference Include="Riok.Mapperly" Version="3.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.Extensions.Options" />
<Using Include="Microsoft.AspNetCore.Identity" />
<Using Include="Microsoft.EntityFrameworkCore" />
<Using Include="Microsoft.AspNetCore.OData.Query" />
<Using Include="Microsoft.AspNetCore.Authorization" />
<Using Include="Microsoft.EntityFrameworkCore.Migrations" />
<Using Include="Microsoft.EntityFrameworkCore.Metadata.Builders" />
<Using Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<Using Include="Bit.TemplatePlayground.Server.Data" />
<Using Include="Bit.TemplatePlayground.Server.Mappers" />
<Using Include="Bit.TemplatePlayground.Shared.Enums" />
<Using Include="Microsoft.AspNetCore.Identity" />
<Using Include="Microsoft.EntityFrameworkCore" />
<Using Include="Microsoft.AspNetCore.OData.Query" />
<Using Include="Microsoft.AspNetCore.Mvc" />

<None Update="IdentityCertificate.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

<Content Include=".config\dotnet-tools.json" />
</ItemGroup>

<ItemGroup>
Expand All @@ -67,7 +73,6 @@
</ItemGroup>

<ItemGroup>
<Content Include=".config\dotnet-tools.json" />
<Compile Update="**\*.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand All @@ -79,17 +84,11 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="IdentityCertificate.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<!-- https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container -->
<PropertyGroup>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<EnableSdkContainerDebugging>True</EnableSdkContainerDebugging>
<UserSecretsId>21D250BE-CAF7-44E4-8DAC-AFA502B0E2F2</UserSecretsId>
<UserSecretsId>65C62680-719C-4F56-9BF7-88F34AF733EF</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public async Task<OverallAnalyticsStatsDataResponseDto> GetOverallAnalyticsStats
}

[HttpGet]
public async Task<IAsyncEnumerable<ProductsCountPerCategoryResponseDto>> GetProductsCountPerCategoryStats(CancellationToken cancellationToken)
public IQueryable<ProductsCountPerCategoryResponseDto> GetProductsCountPerCategoryStats()
{
return DbContext.Categories
.Select(c => new ProductsCountPerCategoryResponseDto()
{
CategoryName = c.Name,
CategoryColor = c.Color,
ProductCount = c.Products!.Count()
}).AsAsyncEnumerable();
});
}

[HttpGet]
public async Task<IAsyncEnumerable<ProductSaleStatResponseDto>> GetProductsSalesStats(CancellationToken cancellationToken)
public IQueryable<ProductSaleStatResponseDto> GetProductsSalesStats()
{
Random rand = new Random();
return DbContext.Products.Include(p => p.Category)
Expand All @@ -43,12 +43,12 @@ public async Task<IAsyncEnumerable<ProductSaleStatResponseDto>> GetProductsSales
ProductName = p.Name,
CategoryColor = p.Category!.Color,
SaleAmount = rand.Next(1, 10) * p.Price
}).AsAsyncEnumerable();
});
}


[HttpGet]
public async Task<ProductPercentagePerCategoryResponseDto[]> GetProductsPercentagePerCategoryStats(CancellationToken cancellationToken)
public async Task<List<ProductPercentagePerCategoryResponseDto>> GetProductsPercentagePerCategoryStats(CancellationToken cancellationToken)
{
var productsTotalCount = await DbContext.Products.CountAsync(cancellationToken);

Expand All @@ -63,6 +63,6 @@ public async Task<ProductPercentagePerCategoryResponseDto[]> GetProductsPercenta
CategoryName = c!.Name,
CategoryColor = c.Color,
ProductPercentage = (float)decimal.Divide(c.Products!.Count(), productsTotalCount) * 100
}).ToArrayAsync(cancellationToken);
}).ToListAsync(cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
using System.Runtime.Loader;
using System.Web;
using Bit.TemplatePlayground.Client.Core.Services;
using Bit.TemplatePlayground.Server.Components;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Components.Endpoints;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Http.Extensions;

namespace Bit.TemplatePlayground.Server.Startup;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using HealthChecks.UI.Client;

namespace Bit.TemplatePlayground.Server;

public class Middlewares
public static partial class Program
{
/// <summary>
/// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-8.0#middleware-order
/// </summary>
public static void Use(WebApplication app, IHostEnvironment env, IConfiguration configuration)
public static void ConfiureMiddlewares(this WebApplication app)
{
var configuration = app.Configuration;
var env = app.Environment;

app.UseForwardedHeaders();

if (AppRenderMode.MultilingualEnabled)
Expand Down Expand Up @@ -71,6 +74,7 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration

app.UseAntiforgery();


app.UseSwagger();

app.UseSwaggerUI(options =>
Expand All @@ -84,6 +88,7 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration
QueryStringParameter = queryStringParameter
}).WithTags("Test");


app.MapGet("/.well-known/apple-app-site-association", async () =>
{
// https://branch.io/resources/aasa-validator/
Expand All @@ -92,6 +97,7 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration
return Results.Stream(File.OpenRead(path), contentType, "apple-app-site-association");
}).ExcludeFromDescription();


app.MapControllers().RequireAuthorization();

var appSettings = configuration.GetSection(nameof(AppSettings)).Get<AppSettings>()!;
Expand All @@ -113,8 +119,9 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration
});
}


// Handle the rest of requests with blazor
var blazorApp = app.MapRazorComponents<App>()
var blazorApp = app.MapRazorComponents<Bit.TemplatePlayground.Server.Components.App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(AssemblyLoadContext.Default.Assemblies.Where(asm => asm.GetName().Name?.Contains("Bit.TemplatePlayground") is true).Except([Assembly.GetExecutingAssembly()]).ToArray());
Expand Down
Loading

0 comments on commit 228f098

Please sign in to comment.