Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SapiensAnatis committed Sep 5, 2024
1 parent 25b0ca2 commit a0870e3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimenta
dotnet_diagnostic.RMG012.severity = error # Unmapped target member
dotnet_diagnostic.RMG020.severity = error # Unmapped source member

# BannedApiAnalyzers
dotnet_diagnostic.RS0030.severity = error # Banned symbol

[DragaliaAPI/DragaliaAPI.Database/Migrations/*.cs]
generated_code = true

Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.8" />
<PackageVersion Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public class DbTimeAttackClear
/// Used to only allow 1 displayed leaderboard entry per set of players.
/// </remarks>
[NotMapped]
public int PlayersHash => 1;
public int PlayersHash =>
string.Join(string.Empty, this.Players.Select(x => x.ViewerId).Order()).GetHashCode();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using Microsoft.EntityFrameworkCore;

namespace DragaliaAPI.Database.Entities;
Expand Down
1 change: 1 addition & 0 deletions DragaliaAPI/DragaliaAPI/BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
T:LinqToDB.AsyncExtensions;Don't use Linq2DB methods that conflict with Entity Framework, use e.g. ToListAsyncLinq2DB instead.
8 changes: 8 additions & 0 deletions DragaliaAPI/DragaliaAPI/DragaliaAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<IncludeAssets>build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" />
Expand Down Expand Up @@ -74,6 +78,10 @@
<Using Include="DragaliaAPI.Extensions" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="BannedSymbols.txt" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DragaliaAPI.Database\DragaliaAPI.Database.csproj" />
<ProjectReference Include="..\..\Shared\DragaliaAPI.Photon.Shared\DragaliaAPI.Photon.Shared.csproj" />
Expand Down
14 changes: 13 additions & 1 deletion DragaliaAPI/DragaliaAPI/Infrastructure/Linq2Db/Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@

namespace DragaliaAPI.Infrastructure.Linq2Db;

/// <summary>
/// Helper class for using JSON columns with Linq2DB.
/// </summary>
/// <remarks>
/// Adapted from https://github.com/linq2db/linq2db/issues/4343#issuecomment-1816460380
/// </remarks>
internal static class Json
{
sealed class JsonValuePathBuilder : Sql.IExtensionCallBuilder
private sealed class JsonValuePathBuilder : Sql.IExtensionCallBuilder
{
public void Build(Sql.ISqExtensionBuilder builder)
{
Expand Down Expand Up @@ -42,6 +48,12 @@ public void Build(Sql.ISqExtensionBuilder builder)
}
}

/// <summary>
/// Access the JSON object property named by <paramref name="name"/> inside the JSON column <paramref name="prop" />
/// </summary>
/// <param name="prop">The JSON column to index.</param>
/// <param name="name">The property name of the object to access.</param>
/// <returns>The indexed value.</returns>
[Sql.Extension(
ProviderName.PostgreSQL,
Precedence = Precedence.Primary,
Expand Down
2 changes: 2 additions & 0 deletions Website/tests/timeAttack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ test('clicking icons shows info popovers', async ({ page }) => {

await waitForImagesToLoad(page);

await page.waitForTimeout(500); // ???

const topRow = page.getByRole('row', { name: /1 Qwerby/ });

await topRow.getByRole('button', { name: 'Expand character details' }).first().click();
Expand Down

0 comments on commit a0870e3

Please sign in to comment.