Skip to content

Commit

Permalink
Merge pull request #147 from SakuraIsayeki/develop
Browse files Browse the repository at this point in the history
0.16.3.1 - Bugfixes & QoL improvements
  • Loading branch information
SakuraIsayeki committed Jun 16, 2023
2 parents 83aa1bb + 325da18 commit 5687252
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 108 deletions.
37 changes: 29 additions & 8 deletions WowsKarma.Api/Services/NotificationService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Microsoft.AspNetCore.SignalR;
using System.Runtime.CompilerServices;
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.Extensions.Logging;
using WowsKarma.Api.Data;
using WowsKarma.Api.Data.Models.Notifications;
Expand Down Expand Up @@ -94,23 +97,41 @@ public static class NotificationServiceExtensions
public static IQueryable<NotificationBase> IncludeAllNotificationsChildNavs(this IQueryable<NotificationBase> query)
{
//PlatformBanNotification
query = query.Include(n => (n as PlatformBanNotification).Ban);
query = query.Include(static n => (n as PlatformBanNotification).Ban);


// PostAddedNotification
query = query.Include(n => (n as PostAddedNotification).Post);
query = query.IncludeAllPostNotificationsChildNavs<PostAddedNotification>();

//PostEditedNotification
query = query.Include(n => (n as PostEditedNotification).Post);
query = query.IncludeAllPostNotificationsChildNavs<PostEditedNotification>();

//PostDeletedNotification
query = query.Include(n => (n as PostDeletedNotification).Post);
query = query.IncludeAllPostNotificationsChildNavs<PostDeletedNotification>();

// PostModEditedNotification
query = query.Include(n => (n as PostModEditedNotification).ModAction);
query = query.Include(static n => (n as PostModEditedNotification).ModAction);

// PostModDeletedNotification
query = query.Include(n => (n as PostModDeletedNotification).ModAction);
query = query.Include(static n => (n as PostModDeletedNotification).ModAction);

return query;
}

/// <summary>
/// Returns a queryable of type <typeparamref name="TNotification"/> that includes all <see cref="PostNotificationBase"/> child navigation properties.
/// </summary>
/// <returns>An included queryable of type <typeparamref name="TNotification"/> that includes all <see cref="PostNotificationBase"/> child navigation properties. </returns>
[Pure, MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IQueryable<NotificationBase> IncludeAllPostNotificationsChildNavs<TNotification>(this IQueryable<NotificationBase> query)
where TNotification : PostNotificationBase
{
query = query.Include(static n => (n as TNotification).Post)
.ThenInclude(static p => p.Author);

query = query.Include(static n => (n as TNotification).Post)
.ThenInclude(static p => p.Player);

return query;
}
}
3 changes: 2 additions & 1 deletion WowsKarma.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ public void ConfigureServices(IServiceCollection services)

services.AddSingleton(s => new PublicApiOptions
{
AppId = s.GetRequiredService<IConfiguration>()[$"Api:{ApiRegion.ToRegionString()}:AppId"]
AppId = s.GetRequiredService<IConfiguration>()[$"Api:{ApiRegion.ToRegionString()}:AppId"]
?? throw new InvalidOperationException("AppId not found in configuration"),
});

services.AddWowsReplayUnpacker(builder =>
Expand Down
35 changes: 16 additions & 19 deletions WowsKarma.Api/WowsKarma.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Version>0.16.3</Version>
<Version>0.16.3.1</Version>
<Authors>Sakura Akeno Isayeki</Authors>
<Company>Nodsoft Systems</Company>
<Product>WOWS Karma (API)</Product>
Expand Down Expand Up @@ -33,41 +33,38 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.15.0" />
<PackageReference Include="Delegate.SassBuilder" Version="1.4.0" />
<PackageReference Include="DSharpPlus" Version="4.3.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="DSharpPlus" Version="4.4.2" />
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="7.0.0" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.33" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.2" />
<PackageReference Include="Hangfire.PostgreSql" Version="1.19.12" />
<PackageReference Include="Hangfire.Tags.PostgreSql" Version="1.9.5" />
<PackageReference Include="Hangfire.Tags.PostgreSql" Version="1.9.6" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.0" />
<PackageReference Include="Mapster.EFCore" Version="5.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="7.0.4" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.7" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="7.0.7" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="NodaTime" Version="3.1.6" />
<PackageReference Include="Nodsoft.Wargaming.Api.Client" Version="0.2.6" />
<PackageReference Include="Nodsoft.WowsReplaysUnpack.ExtendedData" Version="2.0.12-alpha-g4b27da27ea" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Nodsoft.Wargaming.Api.Client" Version="0.3.5" />
<PackageReference Include="Nodsoft.WowsReplaysUnpack.ExtendedData" Version="2.0.14-alpha-g0002f59a1d" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.27.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.31.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion wowskarma.app/src/app/services/api/models/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export enum NotificationType {

export type PostNotification = Notification & { postId: string, post: PlayerPostDto }
export type PostModDeletedNotification = Notification & { modActionId: string, modAction: PostModActionDto }
export type PlatformBanNotification = Notification & { reason: string, until?: Date }
export type PostModEditedNotification = Notification & { modActionId: string, modAction: PostModActionDto }
export type PlatformBanNotification = Notification & { reason: string, until?: Date }
Loading

0 comments on commit 5687252

Please sign in to comment.