Skip to content

Commit

Permalink
Merge branch 'main' into feature/posts
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsPilgaard committed Dec 8, 2024
2 parents 8a40302 + 3bd483a commit 14031d3
Show file tree
Hide file tree
Showing 51 changed files with 472 additions and 382 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container_apps_chat_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
dotnet-version: "9.x"

- name: Test
run: dotnet test "${{ env.TEST_DIRECTORY }}" --filter Category!=ManualTest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container_apps_chat_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
dotnet-version: "9.x"

- name: Test
# Dependabot cannot access secrets, so we disable this step for Dependabot
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website_backend_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
dotnet-version: "9.x"

- name: Test
# Dependabot cannot access secrets, so we disable this step for Dependabot
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
dotnet-version: "9.x"

- name: Restore Nugets
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/website_frontend_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/dotnet:v1.45.1-jammy
image: mcr.microsoft.com/playwright/dotnet:v1.49.0-jammy
options: --user 1001
steps:
- name: Checkout
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
dotnet-version: "9.x"

- name: Test
run: >
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/Jordnaer.Benchmarks/Jordnaer.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Bogus" Version="35.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7" />
<PackageReference Include="Bogus" Version="35.6.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/container_apps/Jordnaer.Chat/Jordnaer.Chat.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<UserSecretsId>6af4abd1-e8ca-4aa2-a593-15395d30dc2a</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
Expand All @@ -11,12 +11,12 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />

<PackageReference Include="MassTransit.AspNetCore" Version="7.3.1" />
<PackageReference Include="MassTransit.Azure.ServiceBus.Core" Version="8.2.3" />
<PackageReference Include="MassTransit.Azure.ServiceBus.Core" Version="8.3.3" />

<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.3.0" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.0.0" />

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 0 additions & 2 deletions src/container_apps/Jordnaer.Chat/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
{
var builder = WebApplication.CreateBuilder(args);

builder.AddAzureAppConfiguration();

builder.AddSerilog();

builder.AddDatabase();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.1.43" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.2.50" />
<PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.5.0" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.3.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="4.0.0" />
</ItemGroup>
</Project>
18 changes: 9 additions & 9 deletions src/shared/Jordnaer.Shared/Jordnaer.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Jordnaer.Shared</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.7.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
<PackageReference Include="NetEscapades.EnumGenerators" Version="1.0.0-beta09" />
<PackageReference Include="Refit.HttpClientFactory" Version="7.1.2" />
<PackageReference Include="MassTransit.Abstractions" Version="8.2.4" />
<PackageReference Include="Refit.HttpClientFactory" Version="8.0.0" />
<PackageReference Include="MassTransit.Abstractions" Version="8.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<h2 class="font-open-sans-light">Registreringsbekræftelse</h2>

<MudText Class="my-4">Check venligst din email for at bekræfte din konto. </MudText>
<MudAlert Severity="Severity.Info" Class="mt-4">Husk at tjekke uønsket mail mappen.</MudAlert>
<MudAlert Severity="Severity.Info" Class="mt-4">Husk at tjekke spam/uønsket mail.</MudAlert>
</MudContainer>

@code {
Expand Down
47 changes: 47 additions & 0 deletions src/web/Jordnaer/Components/ScrollToTopComponentBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Components;
using MudBlazor;

namespace Jordnaer.Components;

public class ScrollToTopComponentBase : ComponentBase, IDisposable, IAsyncDisposable
{
[Inject]
private IScrollManager ScrollManager { get; set; } = null!;

private CancellationTokenSource? _cancellationTokenSource;

protected CancellationToken CancellationToken => (_cancellationTokenSource ??= new CancellationTokenSource()).Token;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
await ScrollManager.ScrollToTopAsync("html");
}

public void Dispose()
{
GC.SuppressFinalize(this);

if (_cancellationTokenSource is null)
{
return;
}

_cancellationTokenSource.Cancel();
_cancellationTokenSource.Dispose();
_cancellationTokenSource = null;
}

public async ValueTask DisposeAsync()
{
GC.SuppressFinalize(this);

if (_cancellationTokenSource is null)
{
return;
}

await _cancellationTokenSource.CancelAsync();
_cancellationTokenSource.Dispose();
_cancellationTokenSource = null;
}
}
5 changes: 5 additions & 0 deletions src/web/Jordnaer/Extensions/JsRuntimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public static async Task<bool> HideElement(this IJSRuntime jsRuntime, string sel
=> await jsRuntime.InvokeVoidAsyncWithErrorHandling(
"utilities.hideElement",
selector);

public static async Task<bool> ShowElement(this IJSRuntime jsRuntime, string selector)
=> await jsRuntime.InvokeVoidAsyncWithErrorHandling(
"utilities.showElement",
selector);
public static async ValueTask<GeoLocation?> GetGeolocation(this IJSRuntime jsRuntime)
{
var (success, geoLocation) = await jsRuntime.InvokeAsyncWithErrorHandling<GeoLocation>("utilities.getGeolocation");
Expand Down
10 changes: 10 additions & 0 deletions src/web/Jordnaer/Extensions/MudColorExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using MudBlazor.Utilities;

namespace Jordnaer.Extensions;

public static class MudColorExtensions
{
public static string ToBackgroundColor(this MudColor color) => $"background-color: {color}";

public static string ToTextColor(this MudColor color) => $"color: {color}";
}
3 changes: 2 additions & 1 deletion src/web/Jordnaer/Features/Chat/ChatNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
namespace Jordnaer.Features.Chat;

public class ChatNotificationService(
JordnaerDbContext context,
IDbContextFactory<JordnaerDbContext> contextFactory,
ILogger<StartChatConsumer> logger,
IPublishEndpoint publishEndpoint,
IServer server)
{
public async Task NotifyRecipients(StartChat startChat, CancellationToken cancellationToken = default)
{
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
var recipientIds = startChat.Recipients.Select(recipient => recipient.Id);
var recipients = await context.Users
.AsNoTracking()
Expand Down
3 changes: 2 additions & 1 deletion src/web/Jordnaer/Features/GroupSearch/GroupSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IGroupSearchService
}

public class GroupSearchService(
JordnaerDbContext context,
IDbContextFactory<JordnaerDbContext> contextFactory,
IZipCodeService zipCodeService)
: IGroupSearchService
{
Expand All @@ -21,6 +21,7 @@ public async Task<GroupSearchResult> GetGroupsAsync(GroupSearchFilter filter,
{
JordnaerMetrics.GroupSearchesCounter.Add(1, MakeTagList(filter));

await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
var groups = context.Groups
.AsNoTracking()
.AsQueryable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Jordnaer.Features.GroupSearch;

internal static class GroupSearchServiceExtensions
internal static class QueryableGroupExtensions
{
internal static IQueryable<Group> ApplyNameFilter(this IQueryable<Group> groups, string? name)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Jordnaer.Database;
using Mediator;
using Microsoft.EntityFrameworkCore;

namespace Jordnaer.Features.Images;

public class ExternalProfilePictureDownloader(
JordnaerDbContext context,
IDbContextFactory<JordnaerDbContext> contextFactory,
ILogger<ExternalProfilePictureDownloader> logger,
IEnumerable<IExternalProviderPictureDownloader> providerPictureDownloader)
: INotificationHandler<AccessTokenAcquired>
Expand All @@ -19,6 +20,7 @@ public async ValueTask Handle(AccessTokenAcquired notification, CancellationToke
return;
}

await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
var user = await context.UserProfiles.FindAsync([notification.UserId], cancellationToken);
if (user is null)
{
Expand Down
Loading

0 comments on commit 14031d3

Please sign in to comment.