mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Adds metadata aggregation to the media library enrichment job
This commit is contained in:
1 parent
c82fadc7a2
commit
66871ccf62
168 files changed
+3503
-1062
No files matched your search
+9
-12
@@ -1,13 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Settings;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -27,6 +26,7 @@ public class GetUserSettingsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
{
|
||||
private HttpClient _client;
|
||||
private readonly AuthenticatedLuminaApiFactory _apiFactory;
|
||||
private readonly UserSettingsEntityFixture _userSettingsEntityFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
@@ -71,7 +71,7 @@ public class GetUserSettingsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
Assert.Equal(storedSettings.UserId, result!.UserId);
|
||||
Assert.Equal(storedSettings.IsPaginationEnabled, result.IsPaginationEnabled);
|
||||
Assert.Equal(storedSettings.ItemsPerPage, result.ItemsPerPage);
|
||||
Assert.Equal(storedSettings.IgnoreThePrefixForAlphaPicker, result.IgnoreThePrefixForAlphaPicker);
|
||||
Assert.Equal(storedSettings.ShouldIgnoreThePrefixForAlphaPicker, result.ShouldIgnoreThePrefixForAlphaPicker);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -90,7 +90,7 @@ public class GetUserSettingsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result!.IsPaginationEnabled);
|
||||
Assert.Equal(48, result.ItemsPerPage);
|
||||
Assert.False(result.IgnoreThePrefixForAlphaPicker);
|
||||
Assert.False(result.ShouldIgnoreThePrefixForAlphaPicker);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,14 +112,11 @@ public class GetUserSettingsEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
|
||||
Guid userId = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername).Id;
|
||||
UserSettingsEntity settings = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
UserId = userId,
|
||||
IsPaginationEnabled = false,
|
||||
ItemsPerPage = 24,
|
||||
IgnoreThePrefixForAlphaPicker = true
|
||||
};
|
||||
UserSettingsEntity settings = _userSettingsEntityFixture.Create(
|
||||
userId: userId,
|
||||
isPaginationEnabled: false,
|
||||
itemsPerPage: 24,
|
||||
shouldIgnoreThePrefixForAlphaPicker: true);
|
||||
|
||||
dbContext.UserSettings.Add(settings);
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
+21
-16
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
|
||||
using Lumina.Contracts.Requests.UsersManagement.Settings;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Lumina.Presentation.Api.IntegrationTests.Common.Setup;
|
||||
@@ -28,6 +29,7 @@ public class UpdateUserSettingsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
{
|
||||
private HttpClient _client;
|
||||
private readonly AuthenticatedLuminaApiFactory _apiFactory;
|
||||
private readonly UpdateUserSettingsRequestFixture _updateUserSettingsRequestFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
@@ -56,11 +58,12 @@ public class UpdateUserSettingsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
public async Task UpdateUserSettings_WhenCalledWithValidRequest_ShouldUpdateSettings()
|
||||
{
|
||||
// Arrange
|
||||
UpdateUserSettingsRequest request = new(
|
||||
IsPaginationEnabled: false,
|
||||
ItemsPerPage: 24,
|
||||
IgnoreThePrefixForAlphaPicker: true,
|
||||
IsThemeCachingEnabled: false
|
||||
UpdateUserSettingsRequest request = _updateUserSettingsRequestFixture.Create(
|
||||
isPaginationEnabled: false,
|
||||
itemsPerPage: 24,
|
||||
shouldIgnoreThePrefixForAlphaPicker: true,
|
||||
isThemeCachingEnabled: false,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -77,7 +80,7 @@ public class UpdateUserSettingsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
Assert.NotNull(storedSettings);
|
||||
Assert.False(storedSettings.IsPaginationEnabled);
|
||||
Assert.Equal(24, storedSettings.ItemsPerPage);
|
||||
Assert.True(storedSettings.IgnoreThePrefixForAlphaPicker);
|
||||
Assert.True(storedSettings.ShouldIgnoreThePrefixForAlphaPicker);
|
||||
Assert.False(storedSettings.IsThemeCachingEnabled);
|
||||
}
|
||||
|
||||
@@ -85,11 +88,12 @@ public class UpdateUserSettingsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
public async Task UpdateUserSettings_WhenItemsPerPageIsNotPositive_ShouldReturnValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateUserSettingsRequest request = new(
|
||||
IsPaginationEnabled: true,
|
||||
ItemsPerPage: 0,
|
||||
IgnoreThePrefixForAlphaPicker: false,
|
||||
IsThemeCachingEnabled: true
|
||||
UpdateUserSettingsRequest request = _updateUserSettingsRequestFixture.Create(
|
||||
isPaginationEnabled: true,
|
||||
itemsPerPage: 0,
|
||||
shouldIgnoreThePrefixForAlphaPicker: false,
|
||||
isThemeCachingEnabled: true,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -118,11 +122,12 @@ public class UpdateUserSettingsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
{
|
||||
// Arrange
|
||||
HttpClient unauthenticatedClient = _apiFactory.CreateClient();
|
||||
UpdateUserSettingsRequest request = new(
|
||||
IsPaginationEnabled: true,
|
||||
ItemsPerPage: 48,
|
||||
IgnoreThePrefixForAlphaPicker: false,
|
||||
IsThemeCachingEnabled: true
|
||||
UpdateUserSettingsRequest request = _updateUserSettingsRequestFixture.Create(
|
||||
isPaginationEnabled: true,
|
||||
itemsPerPage: 48,
|
||||
shouldIgnoreThePrefixForAlphaPicker: false,
|
||||
isThemeCachingEnabled: true,
|
||||
shouldAggregateMetadataWhenMissing: false
|
||||
);
|
||||
|
||||
// Act
|
||||
|
||||
Reference in new issue
Block a user