From 46b4a1e2e22dc2b5389d1b7b4b479e8569bbfa58 Mon Sep 17 00:00:00 2001 From: ImoutoChan Date: Sun, 1 Dec 2024 12:05:21 +0500 Subject: [PATCH] Add date in file info; When you click calculate hash, it will be compared with the stored hash for the file; if they are different, the hash will be highlighted in red --- CHANGELOG.md | 5 + Source/Directory.Packages.props | 1 + .../ImoutoRebirth.Common.WebApi.csproj | 2 + .../NodaTime/NamingPolicyParameterFilter.cs | 15 + .../NodaTime/NodaTimeSchemaSettings.cs | 40 +++ .../NodaTime/NodaTimeSchemaSettingsFactory.cs | 18 + .../NodaTime/SchemaExamples.cs | 69 ++++ .../NodaTime/Schemas.cs | 34 ++ .../NodaTime/SchemasFactory.cs | 68 ++++ .../NodaTime/SwaggerGenOptionsExtensions.cs | 52 +++ .../ServiceCollectionExtensions.cs | 4 +- .../Services/Tags/FileService.cs | 6 + .../Services/Tags/IFileService.cs | 2 + .../Services/Tags/Model/FileMetadata.cs | 5 + .../View/FileInfoView.xaml | 19 +- .../ViewModel/FileInfoVM.cs | 28 +- .../CollectionFileMetadataQuery.cs | 8 + .../ImoutoRebirth.Room.Application.csproj | 4 + .../CollectionFileMetadataQueryHandler.cs | 27 ++ .../CollectionsApiTests.cs | 40 +++ .../WebApi/EndpointsMappings.cs | 4 + .../WebApi/WebApiStartup.cs | 24 +- .../Clients.cs | 318 ++++++++++++------ Tools/NSwagGeneration/DefaultService.nswag | 2 +- Tools/NukeBuild/Build.cs | 3 +- 25 files changed, 688 insertions(+), 110 deletions(-) create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NamingPolicyParameterFilter.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettings.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettingsFactory.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemaExamples.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/Schemas.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemasFactory.cs create mode 100644 Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SwaggerGenOptionsExtensions.cs create mode 100644 Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/Model/FileMetadata.cs create mode 100644 Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/Cqrs/CollectionFileSlice/CollectionFileMetadataQuery.cs create mode 100644 Source/ImoutoRebirth.Room/ImoutoRebirth.Room.DataAccess/Queries/CollectionFileMetadataQueryHandler.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index e048a8a3..099155d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ * Add Resqueue dashboard * Add new videos in README for the initial launch and configuration of collections +### Navigator +* Add date in file info +* When you click calculate hash, it will be compared with the stored hash for the file; +if they are different, the hash will be highlighted in red + # 4.26.1 ### Infrastructure diff --git a/Source/Directory.Packages.props b/Source/Directory.Packages.props index 6905b228..0d3b4c0a 100644 --- a/Source/Directory.Packages.props +++ b/Source/Directory.Packages.props @@ -90,5 +90,6 @@ + diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ImoutoRebirth.Common.WebApi.csproj b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ImoutoRebirth.Common.WebApi.csproj index 6f462dbe..336f889c 100644 --- a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ImoutoRebirth.Common.WebApi.csproj +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ImoutoRebirth.Common.WebApi.csproj @@ -9,6 +9,8 @@ + + diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NamingPolicyParameterFilter.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NamingPolicyParameterFilter.cs new file mode 100644 index 00000000..412ed2a8 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NamingPolicyParameterFilter.cs @@ -0,0 +1,15 @@ +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +internal class NamingPolicyParameterFilter : IParameterFilter +{ + private readonly NodaTimeSchemaSettings _nodaTimeSchemaSettings; + + public NamingPolicyParameterFilter(NodaTimeSchemaSettings nodaTimeSchemaSettings) + => _nodaTimeSchemaSettings = nodaTimeSchemaSettings; + + public void Apply(OpenApiParameter parameter, ParameterFilterContext context) + => parameter.Name = _nodaTimeSchemaSettings.ResolvePropertyName(parameter.Name); +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettings.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettings.cs new file mode 100644 index 00000000..3b066985 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettings.cs @@ -0,0 +1,40 @@ +using NodaTime; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public class NodaTimeSchemaSettings +{ + public Func ResolvePropertyName { get; } + + public Func FormatToJson { get; } + + public IDateTimeZoneProvider DateTimeZoneProvider { get; } + + public bool ShouldGenerateExamples { get; } + + public SchemaExamples SchemaExamples { get; } + + /// Function that resolves property name by proper naming strategy. + /// Function that formats object as json text. + /// Should the example node be generated. + /// for schema example values. + /// configured in Startup. + public NodaTimeSchemaSettings( + Func resolvePropertyName, + Func formatToJson, + bool shouldGenerateExamples, + SchemaExamples? schemaExamples = null, + IDateTimeZoneProvider? dateTimeZoneProvider = null) + { + ResolvePropertyName = resolvePropertyName; + FormatToJson = formatToJson; + + DateTimeZoneProvider = dateTimeZoneProvider ?? DateTimeZoneProviders.Tzdb; + + ShouldGenerateExamples = shouldGenerateExamples; + SchemaExamples = schemaExamples ?? new SchemaExamples( + DateTimeZoneProvider, + dateTimeUtc: null, + dateTimeZone: null); + } +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettingsFactory.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettingsFactory.cs new file mode 100644 index 00000000..336ba333 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/NodaTimeSchemaSettingsFactory.cs @@ -0,0 +1,18 @@ +using System.Text.Json; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public static class NodaTimeSchemaSettingsFactory +{ + public static NodaTimeSchemaSettings CreateNodaTimeSchemaSettings( + this JsonSerializerOptions jsonSerializerOptions) + { + return new NodaTimeSchemaSettings(ResolvePropertyName, FormatToJson, true); + + string ResolvePropertyName(string propertyName) + => jsonSerializerOptions.PropertyNamingPolicy?.ConvertName(propertyName) ?? propertyName; + + string FormatToJson(object value) + => JsonSerializer.Serialize(value, jsonSerializerOptions).Trim('\"'); + } +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemaExamples.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemaExamples.cs new file mode 100644 index 00000000..80942452 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemaExamples.cs @@ -0,0 +1,69 @@ +using NodaTime; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public class SchemaExamples +{ + public DateTimeZone DateTimeZone { get; set; } + + public Instant Instant { get; set; } + + public ZonedDateTime ZonedDateTime { get; set; } + + public Interval Interval { get; set; } + + public DateInterval DateInterval { get; set; } + + public Period Period { get; set; } + + public OffsetDate OffsetDate { get; set; } + + public OffsetTime OffsetTime { get; set; } + + public OffsetDateTime OffsetDateTime { get; set; } + + /// + /// Creates example value by provided and . + /// + /// IDateTimeZoneProvider instance. + /// . If not set then will be used. + /// Optional DateTimeZone name. If not set SystemDefault will be used. + public SchemaExamples( + IDateTimeZoneProvider dateTimeZoneProvider, + DateTime? dateTimeUtc = null, + string? dateTimeZone = null) + { + var dateTimeUtcValue = dateTimeUtc ?? DateTime.UtcNow; + + if (dateTimeUtcValue.Kind != DateTimeKind.Utc) + throw new ArgumentException("dateTimeUtc should be UTC", nameof(dateTimeUtc)); + + DateTimeZone = dateTimeZone != null + ? dateTimeZoneProvider.GetZoneOrNull(dateTimeZone) ?? dateTimeZoneProvider.GetSystemDefault() + : dateTimeZoneProvider.GetSystemDefault(); + + Instant = Instant.FromDateTimeUtc(dateTimeUtcValue); + + ZonedDateTime = Instant.InZone(DateTimeZone); + + Interval = new Interval(Instant, + Instant.PlusTicks(TimeSpan.TicksPerDay) + .PlusTicks(TimeSpan.TicksPerHour) + .PlusTicks(TimeSpan.TicksPerMinute) + .PlusTicks(TimeSpan.TicksPerSecond) + .PlusTicks(TimeSpan.TicksPerMillisecond)); + + DateInterval = new DateInterval(ZonedDateTime.Date, ZonedDateTime.Date.PlusDays(1)); + + Period = Period.Between( + ZonedDateTime.LocalDateTime, + Interval.End.InZone(DateTimeZone).LocalDateTime, + PeriodUnits.AllUnits); + + OffsetDate = new OffsetDate(ZonedDateTime.Date, ZonedDateTime.Offset); + + OffsetTime = new OffsetTime(ZonedDateTime.TimeOfDay, ZonedDateTime.Offset); + + OffsetDateTime = Instant.WithOffset(ZonedDateTime.Offset); + } +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/Schemas.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/Schemas.cs new file mode 100644 index 00000000..cce89920 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/Schemas.cs @@ -0,0 +1,34 @@ +using Microsoft.OpenApi.Models; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public class Schemas +{ + public required Func Instant { get; set; } + + public required Func LocalDate { get; set; } + + public required Func LocalTime { get; set; } + + public required Func LocalDateTime { get; set; } + + public required Func OffsetDateTime { get; set; } + + public required Func ZonedDateTime { get; set; } + + public required Func Interval { get; set; } + + public required Func DateInterval { get; set; } + + public required Func Offset { get; set; } + + public required Func Period { get; set; } + + public required Func Duration { get; set; } + + public required Func OffsetDate { get; set; } + + public required Func OffsetTime { get; set; } + + public required Func DateTimeZone { get; set; } +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemasFactory.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemasFactory.cs new file mode 100644 index 00000000..9652b761 --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SchemasFactory.cs @@ -0,0 +1,68 @@ +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using NodaTime; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public class SchemasFactory +{ + private readonly NodaTimeSchemaSettings _settings; + + public SchemasFactory(NodaTimeSchemaSettings settings) => _settings = settings; + + public Schemas CreateSchemas() + { + var examples = _settings.SchemaExamples; + + // https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 + return new Schemas + { + Instant = () => StringSchema(examples.Instant, "date-time"), + LocalDate = () => StringSchema(examples.ZonedDateTime.Date, "date"), + LocalTime = () => StringSchema(examples.ZonedDateTime.TimeOfDay), + LocalDateTime = () => StringSchema(examples.ZonedDateTime.LocalDateTime), + OffsetDateTime = () => StringSchema(examples.OffsetDateTime, "date-time"), + ZonedDateTime = () => StringSchema(examples.ZonedDateTime), + Interval = () => new OpenApiSchema + { + Type = "object", + Properties = new Dictionary + { + { ResolvePropertyName(nameof(Interval.Start)), StringSchema(examples.Interval.Start, "date-time") }, + { ResolvePropertyName(nameof(Interval.End)), StringSchema(examples.Interval.End, "date-time") }, + }, + }, + DateInterval = () => new OpenApiSchema + { + Type = "object", + Properties = new Dictionary + { + { ResolvePropertyName(nameof(DateInterval.Start)), StringSchema(examples.DateInterval.Start, "date") }, + { ResolvePropertyName(nameof(DateInterval.End)), StringSchema(examples.DateInterval.End, "date") }, + }, + }, + Offset = () => StringSchema(examples.ZonedDateTime.Offset), + Period = () => StringSchema(examples.Period), + Duration = () => StringSchema(examples.Interval.Duration), + OffsetDate = () => StringSchema(examples.OffsetDate), + OffsetTime = () => StringSchema(examples.OffsetTime), + DateTimeZone = () => StringSchema(examples.DateTimeZone), + }; + } + + private OpenApiSchema StringSchema(object exampleObject, string? format = null) + { + return new OpenApiSchema + { + Type = "string", + Example = _settings.ShouldGenerateExamples + ? new OpenApiString(FormatToJson(exampleObject)) + : null, + Format = format + }; + } + + private string ResolvePropertyName(string propertyName) => _settings.ResolvePropertyName(propertyName); + + private string FormatToJson(object value) => _settings.FormatToJson(value); +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SwaggerGenOptionsExtensions.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SwaggerGenOptionsExtensions.cs new file mode 100644 index 00000000..e0e5cfaa --- /dev/null +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/NodaTime/SwaggerGenOptionsExtensions.cs @@ -0,0 +1,52 @@ +using System.Text.Json; +using Microsoft.Extensions.DependencyInjection; +using NodaTime; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace ImoutoRebirth.Common.WebApi.NodaTime; + +public static class SwaggerGenOptionsExtensions +{ + public static void ConfigureForNodaTime(this SwaggerGenOptions config, JsonSerializerOptions options) + { + ArgumentNullException.ThrowIfNull(config); + + var nodaTimeSchemaSettings = options.CreateNodaTimeSchemaSettings(); + config.ConfigureForNodaTime(nodaTimeSchemaSettings); + } + + public static void ConfigureForNodaTime(this SwaggerGenOptions config, NodaTimeSchemaSettings nodaTimeSchemaSettings) + { + config.ParameterFilter(nodaTimeSchemaSettings); + + var schemas = new SchemasFactory(nodaTimeSchemaSettings).CreateSchemas(); + + config.MapType (schemas.Instant); + config.MapType (schemas.LocalDate); + config.MapType (schemas.LocalTime); + config.MapType (schemas.LocalDateTime); + config.MapType (schemas.OffsetDateTime); + config.MapType (schemas.ZonedDateTime); + config.MapType (schemas.Interval); + config.MapType (schemas.DateInterval); + config.MapType (schemas.Offset); + config.MapType (schemas.Period); + config.MapType (schemas.Duration); + config.MapType (schemas.OffsetDate); + config.MapType (schemas.OffsetTime); + config.MapType (schemas.DateTimeZone); + + // Nullable structs + config.MapType (schemas.Instant); + config.MapType (schemas.LocalDate); + config.MapType (schemas.LocalTime); + config.MapType (schemas.LocalDateTime); + config.MapType(schemas.OffsetDateTime); + config.MapType (schemas.ZonedDateTime); + config.MapType (schemas.Interval); + config.MapType (schemas.Offset); + config.MapType (schemas.Duration); + config.MapType (schemas.OffsetDate); + config.MapType (schemas.OffsetTime); + } +} diff --git a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ServiceCollectionExtensions.cs b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ServiceCollectionExtensions.cs index 97ff9294..2f1a9188 100644 --- a/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ServiceCollectionExtensions.cs +++ b/Source/ImoutoRebirth.Common/ImoutoRebirth.Common.WebApi/ServiceCollectionExtensions.cs @@ -55,6 +55,8 @@ public static IServiceCollection AddMinimalSwagger( { c.SchemaFilter(); c.SchemaFilter(); + c.SupportNonNullableReferenceTypes(); + c.NonNullableReferenceTypesAsRequired(); c.SwaggerDoc("v1.0", new OpenApiInfo { @@ -76,7 +78,7 @@ public static IServiceCollection AddMinimalSwagger( return upperControllerName + '_' + name; }); - + configure?.Invoke(c); }); diff --git a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/FileService.cs b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/FileService.cs index 128539e9..4256fbe8 100644 --- a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/FileService.cs +++ b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/FileService.cs @@ -154,6 +154,12 @@ public async Task CountFiles( return roomIds.Count(x => lilinIdsHashSet.Contains(x)); } + public async Task GetFileMetadata(Guid fileId) + { + var meta = await _collectionFilesClient.GetCollectionFileMetadataAsync(fileId); + return new FileMetadata(fileId, meta.StoredMd5, meta.AddedOn); + } + public async Task CountFiles1( Guid? collectionId, IReadOnlyCollection tags, diff --git a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/IFileService.cs b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/IFileService.cs index af579e78..872b0ba7 100644 --- a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/IFileService.cs +++ b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/IFileService.cs @@ -16,5 +16,7 @@ Task CountFiles( IReadOnlyCollection tags, CancellationToken cancellationToken); + Task GetFileMetadata(Guid fileId); + Task RemoveFile(Guid fileId); } diff --git a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/Model/FileMetadata.cs b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/Model/FileMetadata.cs new file mode 100644 index 00000000..6bf83c3f --- /dev/null +++ b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/Services/Tags/Model/FileMetadata.cs @@ -0,0 +1,5 @@ +using ImoutoRebirth.Room.WebApi.Client; + +namespace ImoutoRebirth.Navigator.Services.Tags.Model; + +public record FileMetadata(Guid Id, string StoredMd5, DateTimeOffset AddedOn); diff --git a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/View/FileInfoView.xaml b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/View/FileInfoView.xaml index 2f45c24c..27c77b62 100644 --- a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/View/FileInfoView.xaml +++ b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/View/FileInfoView.xaml @@ -26,6 +26,8 @@ + + - + + + + + + + + diff --git a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/ViewModel/FileInfoVM.cs b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/ViewModel/FileInfoVM.cs index 09df47a4..62b368b9 100644 --- a/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/ViewModel/FileInfoVM.cs +++ b/Source/ImoutoRebirth.Navigator/ImoutoRebirth.Navigator/ViewModel/FileInfoVM.cs @@ -3,12 +3,16 @@ using System.Windows; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using ImoutoRebirth.Navigator.Services; +using ImoutoRebirth.Navigator.Services.Tags; using ImoutoRebirth.Navigator.ViewModel.ListEntries; namespace ImoutoRebirth.Navigator.ViewModel; internal partial class FileInfoVM : ObservableObject { + private readonly IFileService _fileService; + private FileInfo? _fileInfo; [ObservableProperty] @@ -22,6 +26,7 @@ internal partial class FileInfoVM : ObservableObject [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(CalculateHashCommand))] + [NotifyPropertyChangedFor(nameof(IsHashValid))] private string? _hash; [ObservableProperty] @@ -30,6 +35,20 @@ internal partial class FileInfoVM : ObservableObject [ObservableProperty] private bool _hasValue; + [ObservableProperty] + private DateTimeOffset? _addedOn; + + [ObservableProperty] + [NotifyPropertyChangedFor(nameof(IsHashValid))] + private string? _storedHash; + + public bool IsHashValid => Hash == null || StoredHash == null || Hash == StoredHash; + + public FileInfoVM() + { + _fileService = ServiceLocator.GetService(); + } + private bool CanCalculateHash() => Hash == null; [RelayCommand(CanExecute = nameof(CanCalculateHash))] @@ -48,7 +67,7 @@ private async Task CalculateHashAsync() }); } - public void UpdateCurrentInfo(INavigatorListEntry? navigatorListEntry, int number) + public async void UpdateCurrentInfo(INavigatorListEntry? navigatorListEntry, int number) { OrderNumber = number; @@ -75,5 +94,12 @@ public void UpdateCurrentInfo(INavigatorListEntry? navigatorListEntry, int numbe PixelSize = navigatorListEntry is IPixelSizable pixelSizable ? pixelSizable.PixelSize : null; _fileInfo = fi; + + if (navigatorListEntry.DbId.HasValue) + { + var metadata = await _fileService.GetFileMetadata(navigatorListEntry.DbId.Value); + AddedOn = metadata.AddedOn; + StoredHash = metadata.StoredMd5; + } } } diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/Cqrs/CollectionFileSlice/CollectionFileMetadataQuery.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/Cqrs/CollectionFileSlice/CollectionFileMetadataQuery.cs new file mode 100644 index 00000000..a9ea735b --- /dev/null +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/Cqrs/CollectionFileSlice/CollectionFileMetadataQuery.cs @@ -0,0 +1,8 @@ +using ImoutoRebirth.Common.Cqrs.Abstract; +using NodaTime; + +namespace ImoutoRebirth.Room.Application.Cqrs.CollectionFileSlice; + +public record CollectionFileMetadataQuery(Guid Id) : IQuery; + +public record CollectionFileMetadata(Guid Id, string StoredMd5, Instant AddedOn); diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/ImoutoRebirth.Room.Application.csproj b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/ImoutoRebirth.Room.Application.csproj index a716d1c5..5d370cb5 100644 --- a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/ImoutoRebirth.Room.Application.csproj +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.Application/ImoutoRebirth.Room.Application.csproj @@ -7,6 +7,10 @@ true + + + + diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.DataAccess/Queries/CollectionFileMetadataQueryHandler.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.DataAccess/Queries/CollectionFileMetadataQueryHandler.cs new file mode 100644 index 00000000..9c2fe8c1 --- /dev/null +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.DataAccess/Queries/CollectionFileMetadataQueryHandler.cs @@ -0,0 +1,27 @@ +using ImoutoRebirth.Common.Cqrs.Abstract; +using ImoutoRebirth.Room.Application.Cqrs.CollectionFileSlice; +using ImoutoRebirth.Room.Database; +using Microsoft.EntityFrameworkCore; + +namespace ImoutoRebirth.Room.DataAccess.Queries; + +internal class CollectionFileMetadataQueryHandler + : IQueryHandler +{ + private readonly RoomDbContext _roomDbContext; + + public CollectionFileMetadataQueryHandler(RoomDbContext roomDbContext) + => _roomDbContext = roomDbContext; + + public async Task Handle(CollectionFileMetadataQuery query, CancellationToken ct) + { + var id = query.Id; + + var file = await _roomDbContext.CollectionFiles.FirstOrDefaultAsync(x => x.Id == id, ct); + + if (file == null) + return null; + + return new CollectionFileMetadata(file.Id, file.Md5, file.AddedOn); + } +} diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.IntegrationTests/CollectionsApiTests.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.IntegrationTests/CollectionsApiTests.cs index bbeabd2c..64d53de2 100644 --- a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.IntegrationTests/CollectionsApiTests.cs +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.IntegrationTests/CollectionsApiTests.cs @@ -1,4 +1,5 @@ using System.Net.Http.Json; +using System.Text.Json; using FluentAssertions; using ImoutoRebirth.Common.MassTransit; using ImoutoRebirth.Common.Tests; @@ -13,6 +14,8 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +using NodaTime; +using NodaTime.Serialization.SystemTextJson; using Xunit; namespace ImoutoRebirth.Room.IntegrationTests; @@ -211,6 +214,43 @@ public async Task GetCollectionFilesIds() files.Should().HaveCount(2); } + [Fact] + public async Task GetCollectionFileMetadata() + { + // arrange + var (collectionId, sourceFolderPath, destFolderPath) = await CreateDefaultCollection( + sourceShouldCheckFormat: false, + sourceShouldCheckHashFromName: false, + sourceShouldCreateTagsFromSubfolders: false, + sourceShouldAddTagFromFilename: false, + sourceSupportedExtensions: new[] { "jpg" }, + destShouldCreateSubfoldersByHash: false, + destShouldRenameByHash: false); + + var testFile1 = new FileInfo(Path.Combine(_webApp.TestsLocation, "Resources", "file1-5f30f9953332c230d11e3f26db5ae9a0.jpg")); + + testFile1.CopyTo(Path.Combine(sourceFolderPath, testFile1.Name)); + await _mediator.Send(new OverseeCommand()); + + var fileId = _context.CollectionFiles + .Where(x => x.CollectionId == collectionId) + .Select(x => x.Id) + .First(); + + // act + var response = await _httpClient.GetAsync($"/collection-files/{fileId}"); + var file = await response.Content + .ReadFromJsonAsync( + new JsonSerializerOptions(JsonSerializerOptions.Web) + .ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)); + + // assert + file.Should().NotBeNull(); + file!.Id.Should().Be(fileId); + file.StoredMd5.Should().Be("5f30f9953332c230d11e3f26db5ae9a0"); + (SystemClock.Instance.GetCurrentInstant() - file.AddedOn).TotalMinutes.Should().BeLessThan(1); + } + [Fact] public async Task CountCollectionFiles() { diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/EndpointsMappings.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/EndpointsMappings.cs index dc3e674e..c0ae0bae 100644 --- a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/EndpointsMappings.cs +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/EndpointsMappings.cs @@ -65,6 +65,10 @@ public static void MapCollectionFilesEndpoints(this WebApplication app) files.MapDelete("/{id:guid}", (Guid id, IMediator mediator, CancellationToken ct) => mediator.Send(new DeleteCollectionFileCommand(id), ct)) .WithName("DeleteCollectionFile"); + + files.MapGet("/{id:guid}", (Guid id, IMediator mediator, CancellationToken ct) + => mediator.Send(new CollectionFileMetadataQuery(id), ct)) + .WithName("GetCollectionFileMetadata"); } public static void MapDestinationFoldersEndpoints(this WebApplication app) diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/WebApiStartup.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/WebApiStartup.cs index f950f16c..b7b0aee1 100644 --- a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/WebApiStartup.cs +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.UI/WebApi/WebApiStartup.cs @@ -1,9 +1,14 @@ using System.IO.Compression; +using System.Text.Encodings.Web; +using System.Text.Json; using System.Text.Json.Serialization; using ImoutoRebirth.Common.WebApi; +using ImoutoRebirth.Common.WebApi.NodaTime; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.ResponseCompression; using Microsoft.Extensions.DependencyInjection; +using NodaTime; +using NodaTime.Serialization.SystemTextJson; namespace ImoutoRebirth.Room.UI.WebApi; @@ -11,13 +16,12 @@ public static class WebEndpointsExtensions { public static IServiceCollection AddWebEndpoints(this IServiceCollection services) { - services.Configure(x => - x.SerializerOptions.Converters.Add(new JsonStringEnumConverter())); + services.Configure(x => ConfigureDefaults(x.SerializerOptions)); + services.Configure(x => ConfigureDefaults(x.JsonSerializerOptions)); - services.Configure(x => - x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); - - services.AddMinimalSwagger("ImoutoRebirth.Room WebApi Client"); + services.AddMinimalSwagger( + "ImoutoRebirth.Room WebApi Client", + x => x.ConfigureForNodaTime(ConfigureDefaults(new JsonSerializerOptions()))); services.AddResponseCompression(options => { @@ -50,4 +54,12 @@ public static WebApplication MapWebEndpoints(this WebApplication app) return app; } + + private static JsonSerializerOptions ConfigureDefaults(JsonSerializerOptions options) + { + options.Converters.Add(new JsonStringEnumConverter()); + options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); + options.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping; + return options; + } } diff --git a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.WebApi.Client/Clients.cs b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.WebApi.Client/Clients.cs index e4648fdd..5b1e98a4 100644 --- a/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.WebApi.Client/Clients.cs +++ b/Source/ImoutoRebirth.Room/ImoutoRebirth.Room.WebApi.Client/Clients.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //---------------------- @@ -10,6 +10,7 @@ #pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." #pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' #pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" #pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... #pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." #pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" @@ -17,23 +18,25 @@ #pragma warning disable 8603 // Disable "CS8603 Possible null reference return" #pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" #pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." namespace ImoutoRebirth.Room.WebApi.Client { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class CollectionFilesClient { private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public CollectionFilesClient(System.Net.Http.HttpClient httpClient) #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { _httpClient = httpClient; + Initialize(); } private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() @@ -43,15 +46,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() return settings; } - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } } + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + partial void Initialize(); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task> SearchCollectionFilesAsync(CollectionFilesQuery body) { @@ -59,7 +64,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task> SearchCollectionFilesAsync(CollectionFilesQuery body, System.Threading.CancellationToken cancellationToken) { @@ -72,7 +77,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -136,7 +141,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task> FilterCollectionFileHashesAsync(FilterCollectionFileHashesQuery body) { @@ -144,7 +149,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task> FilterCollectionFileHashesAsync(FilterCollectionFileHashesQuery body, System.Threading.CancellationToken cancellationToken) { @@ -157,7 +162,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -221,7 +226,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task> SearchCollectionFileIdsAsync(CollectionFilesQuery body) { @@ -229,7 +234,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task> SearchCollectionFileIdsAsync(CollectionFilesQuery body, System.Threading.CancellationToken cancellationToken) { @@ -242,7 +247,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -306,7 +311,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task CountCollectionFilesAsync(CollectionFilesQuery body) { @@ -314,7 +319,7 @@ public virtual System.Threading.Tasks.Task CountCollectionFilesAsync(Collec } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task CountCollectionFilesAsync(CollectionFilesQuery body, System.Threading.CancellationToken cancellationToken) { @@ -327,7 +332,7 @@ public virtual async System.Threading.Tasks.Task CountCollectionFilesAsync( { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -391,7 +396,7 @@ public virtual async System.Threading.Tasks.Task CountCollectionFilesAsync( } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task UpdateSourceTagsAsync() { @@ -399,7 +404,7 @@ public virtual System.Threading.Tasks.Task UpdateSourceTagsAsync() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task UpdateSourceTagsAsync(System.Threading.CancellationToken cancellationToken) { @@ -464,7 +469,7 @@ public virtual async System.Threading.Tasks.Task UpdateSourceTagsAsync(System.Th } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task DeleteCollectionFileAsync(System.Guid id) { @@ -472,7 +477,7 @@ public virtual System.Threading.Tasks.Task DeleteCollectionFileAsync(System.Guid } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteCollectionFileAsync(System.Guid id, System.Threading.CancellationToken cancellationToken) { @@ -540,6 +545,88 @@ public virtual async System.Threading.Tasks.Task DeleteCollectionFileAsync(Syste } } + /// OK + /// A server side error occurred. + public virtual System.Threading.Tasks.Task GetCollectionFileMetadataAsync(System.Guid id) + { + return GetCollectionFileMetadataAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// OK + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GetCollectionFileMetadataAsync(System.Guid id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "collection-files/{id}" + urlBuilder_.Append("collection-files/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new WebApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new WebApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + protected struct ObjectResponseResult { public ObjectResponseResult(T responseObject, string responseText) @@ -649,17 +736,19 @@ private string ConvertToString(object? value, System.Globalization.CultureInfo c } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class CollectionsClient { private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public CollectionsClient(System.Net.Http.HttpClient httpClient) #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { _httpClient = httpClient; + Initialize(); } private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() @@ -669,15 +758,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() return settings; } - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } } + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + partial void Initialize(); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task> GetAllCollectionsAsync() { @@ -685,7 +776,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetAllCollectionsAsync(System.Threading.CancellationToken cancellationToken) { @@ -755,7 +846,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task CreateCollectionAsync(CreateCollectionCommand body) { @@ -763,7 +854,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task CreateCollectionAsync(CreateCollectionCommand body, System.Threading.CancellationToken cancellationToken) { @@ -776,7 +867,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -840,7 +931,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task RenameCollectionAsync(System.Guid collectionId, string newName) { @@ -848,7 +939,7 @@ public virtual System.Threading.Tasks.Task RenameCollectionAsync(System.Guid col } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task RenameCollectionAsync(System.Guid collectionId, string newName, System.Threading.CancellationToken cancellationToken) { @@ -923,7 +1014,7 @@ public virtual async System.Threading.Tasks.Task RenameCollectionAsync(System.Gu } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task DeleteCollectionAsync(System.Guid collectionId) { @@ -931,7 +1022,7 @@ public virtual System.Threading.Tasks.Task DeleteCollectionAsync(System.Guid col } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteCollectionAsync(System.Guid collectionId, System.Threading.CancellationToken cancellationToken) { @@ -999,7 +1090,7 @@ public virtual async System.Threading.Tasks.Task DeleteCollectionAsync(System.Gu } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task GetDestinationFolderAsync(System.Guid collectionId) { @@ -1007,7 +1098,7 @@ public virtual System.Threading.Tasks.TaskA cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetDestinationFolderAsync(System.Guid collectionId, System.Threading.CancellationToken cancellationToken) { @@ -1082,7 +1173,7 @@ public virtual async System.Threading.Tasks.TaskSuccess + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task DeleteDestinationFolderAsync(System.Guid collectionId) { @@ -1090,7 +1181,7 @@ public virtual System.Threading.Tasks.Task DeleteDestinationFolderAsync(System.G } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(System.Guid collectionId, System.Threading.CancellationToken cancellationToken) { @@ -1159,7 +1250,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task SetDestinationFolderAsync(SetDestinationFolderCommand body) { @@ -1167,7 +1258,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task SetDestinationFolderAsync(SetDestinationFolderCommand body, System.Threading.CancellationToken cancellationToken) { @@ -1180,7 +1271,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -1244,7 +1335,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task> GetSourceFoldersAsync(System.Guid collectionId) { @@ -1252,7 +1343,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetSourceFoldersAsync(System.Guid collectionId, System.Threading.CancellationToken cancellationToken) { @@ -1327,7 +1418,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task AddSourceFolderAsync(AddSourceFolderCommand body) { @@ -1335,7 +1426,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task AddSourceFolderAsync(AddSourceFolderCommand body, System.Threading.CancellationToken cancellationToken) { @@ -1348,7 +1439,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -1412,7 +1503,7 @@ public virtual async System.Threading.Tasks.Task DeleteDestinationFolderAsync(Sy } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task UpdateSourceFolderAsync(UpdateSourceFolderCommand body) { @@ -1420,7 +1511,7 @@ public virtual System.Threading.Tasks.Task UpdateSourceFolderAsync(UpdateSourceF } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task UpdateSourceFolderAsync(UpdateSourceFolderCommand body, System.Threading.CancellationToken cancellationToken) { @@ -1433,7 +1524,7 @@ public virtual async System.Threading.Tasks.Task UpdateSourceFolderAsync(UpdateS { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, _settings.Value); + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); var content_ = new System.Net.Http.ByteArrayContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; @@ -1491,7 +1582,7 @@ public virtual async System.Threading.Tasks.Task UpdateSourceFolderAsync(UpdateS } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task DeleteSourceFolderAsync(System.Guid collectionId, System.Guid sourceFolderId) { @@ -1499,7 +1590,7 @@ public virtual System.Threading.Tasks.Task DeleteSourceFolderAsync(System.Guid c } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteSourceFolderAsync(System.Guid collectionId, System.Guid sourceFolderId, System.Threading.CancellationToken cancellationToken) { @@ -1681,17 +1772,19 @@ private string ConvertToString(object? value, System.Globalization.CultureInfo c } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ImoutoPicsUploaderEnabledClient { private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public ImoutoPicsUploaderEnabledClient(System.Net.Http.HttpClient httpClient) #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. { _httpClient = httpClient; + Initialize(); } private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() @@ -1701,15 +1794,17 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() return settings; } - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } } + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + partial void Initialize(); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task IsImoutoPicsUploaderEnabledAsync() { @@ -1717,7 +1812,7 @@ public virtual System.Threading.Tasks.Task IsImoutoPicsUploaderEnabledAsyn } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task IsImoutoPicsUploaderEnabledAsync(System.Threading.CancellationToken cancellationToken) { @@ -1787,7 +1882,7 @@ public virtual async System.Threading.Tasks.Task IsImoutoPicsUploaderEnabl } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task EnableImoutoPicsUploaderAsync() { @@ -1795,7 +1890,7 @@ public virtual System.Threading.Tasks.Task EnableImoutoPicsUploaderAsync() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task EnableImoutoPicsUploaderAsync(System.Threading.CancellationToken cancellationToken) { @@ -1860,7 +1955,7 @@ public virtual async System.Threading.Tasks.Task EnableImoutoPicsUploaderAsync(S } } - /// Success + /// OK /// A server side error occurred. public virtual System.Threading.Tasks.Task DisableImoutoPicsUploaderAsync() { @@ -1868,7 +1963,7 @@ public virtual System.Threading.Tasks.Task DisableImoutoPicsUploaderAsync() } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success + /// OK /// A server side error occurred. public virtual async System.Threading.Tasks.Task DisableImoutoPicsUploaderAsync(System.Threading.CancellationToken cancellationToken) { @@ -2041,12 +2136,12 @@ private string ConvertToString(object? value, System.Globalization.CultureInfo c } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class AddSourceFolderCommand { [System.Text.Json.Serialization.JsonConstructor] - public AddSourceFolderCommand(System.Guid @collectionId, string? @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Collections.Generic.IReadOnlyCollection? @supportedExtensions) + public AddSourceFolderCommand(System.Guid @collectionId, string @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Collections.Generic.IReadOnlyCollection @supportedExtensions) { @@ -2069,7 +2164,7 @@ public AddSourceFolderCommand(System.Guid @collectionId, string? @path, bool @sh public System.Guid CollectionId { get; } [System.Text.Json.Serialization.JsonPropertyName("path")] - public string? Path { get; } + public string Path { get; } [System.Text.Json.Serialization.JsonPropertyName("shouldCheckFormat")] public bool ShouldCheckFormat { get; } @@ -2084,16 +2179,16 @@ public AddSourceFolderCommand(System.Guid @collectionId, string? @path, bool @sh public bool ShouldAddTagFromFilename { get; } [System.Text.Json.Serialization.JsonPropertyName("supportedExtensions")] - public System.Collections.Generic.IReadOnlyCollection? SupportedExtensions { get; } + public System.Collections.Generic.IReadOnlyCollection SupportedExtensions { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class CollectionFile { [System.Text.Json.Serialization.JsonConstructor] - public CollectionFile(System.Guid @collectionId, System.Guid @id, string? @md5, string? @originalPath, string? @path, long @size) + public CollectionFile(System.Guid @collectionId, System.Guid @id, string @md5, string @originalPath, string @path, long @size) { @@ -2117,20 +2212,47 @@ public CollectionFile(System.Guid @collectionId, System.Guid @id, string? @md5, public System.Guid CollectionId { get; } [System.Text.Json.Serialization.JsonPropertyName("path")] - public string? Path { get; } + public string Path { get; } [System.Text.Json.Serialization.JsonPropertyName("md5")] - public string? Md5 { get; } + public string Md5 { get; } [System.Text.Json.Serialization.JsonPropertyName("size")] public long Size { get; } [System.Text.Json.Serialization.JsonPropertyName("originalPath")] - public string? OriginalPath { get; } + public string OriginalPath { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CollectionFileMetadata + { + [System.Text.Json.Serialization.JsonConstructor] + + public CollectionFileMetadata(System.DateTimeOffset @addedOn, System.Guid @id, string @storedMd5) + + { + + this.Id = @id; + + this.StoredMd5 = @storedMd5; + + this.AddedOn = @addedOn; + + } + [System.Text.Json.Serialization.JsonPropertyName("id")] + public System.Guid Id { get; } + + [System.Text.Json.Serialization.JsonPropertyName("storedMd5")] + public string StoredMd5 { get; } + + [System.Text.Json.Serialization.JsonPropertyName("addedOn")] + public System.DateTimeOffset AddedOn { get; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class CollectionFilesQuery { [System.Text.Json.Serialization.JsonConstructor] @@ -2172,12 +2294,12 @@ public CollectionFilesQuery(System.Collections.Generic.IReadOnlyCollection? @md5Hashes) + public FilterCollectionFileHashesQuery(System.Collections.Generic.IReadOnlyCollection @md5Hashes) { @@ -2298,16 +2420,16 @@ public FilterCollectionFileHashesQuery(System.Collections.Generic.IReadOnlyColle } [System.Text.Json.Serialization.JsonPropertyName("md5Hashes")] - public System.Collections.Generic.IReadOnlyCollection? Md5Hashes { get; } + public System.Collections.Generic.IReadOnlyCollection Md5Hashes { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class SetDestinationFolderCommand { [System.Text.Json.Serialization.JsonConstructor] - public SetDestinationFolderCommand(System.Guid @collectionId, string? @formatErrorSubfolder, string? @hashErrorSubfolder, string? @path, bool @shouldCreateSubfoldersByHash, bool @shouldRenameByHash, string? @withoutHashErrorSubfolder) + public SetDestinationFolderCommand(System.Guid @collectionId, string @formatErrorSubfolder, string @hashErrorSubfolder, string @path, bool @shouldCreateSubfoldersByHash, bool @shouldRenameByHash, string @withoutHashErrorSubfolder) { @@ -2330,7 +2452,7 @@ public SetDestinationFolderCommand(System.Guid @collectionId, string? @formatErr public System.Guid CollectionId { get; } [System.Text.Json.Serialization.JsonPropertyName("path")] - public string? Path { get; } + public string Path { get; } [System.Text.Json.Serialization.JsonPropertyName("shouldCreateSubfoldersByHash")] public bool ShouldCreateSubfoldersByHash { get; } @@ -2339,22 +2461,22 @@ public SetDestinationFolderCommand(System.Guid @collectionId, string? @formatErr public bool ShouldRenameByHash { get; } [System.Text.Json.Serialization.JsonPropertyName("formatErrorSubfolder")] - public string? FormatErrorSubfolder { get; } + public string FormatErrorSubfolder { get; } [System.Text.Json.Serialization.JsonPropertyName("hashErrorSubfolder")] - public string? HashErrorSubfolder { get; } + public string HashErrorSubfolder { get; } [System.Text.Json.Serialization.JsonPropertyName("withoutHashErrorSubfolder")] - public string? WithoutHashErrorSubfolder { get; } + public string WithoutHashErrorSubfolder { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class SourceFolderInfo { [System.Text.Json.Serialization.JsonConstructor] - public SourceFolderInfo(System.Guid @collectionId, System.Guid @id, string? @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Collections.Generic.IReadOnlyCollection? @supportedExtensions) + public SourceFolderInfo(System.Guid @collectionId, System.Guid @id, string @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Collections.Generic.IReadOnlyCollection @supportedExtensions) { @@ -2382,7 +2504,7 @@ public SourceFolderInfo(System.Guid @collectionId, System.Guid @id, string? @pat public System.Guid CollectionId { get; } [System.Text.Json.Serialization.JsonPropertyName("path")] - public string? Path { get; } + public string Path { get; } [System.Text.Json.Serialization.JsonPropertyName("shouldCheckFormat")] public bool ShouldCheckFormat { get; } @@ -2397,16 +2519,16 @@ public SourceFolderInfo(System.Guid @collectionId, System.Guid @id, string? @pat public bool ShouldAddTagFromFilename { get; } [System.Text.Json.Serialization.JsonPropertyName("supportedExtensions")] - public System.Collections.Generic.IReadOnlyCollection? SupportedExtensions { get; } + public System.Collections.Generic.IReadOnlyCollection SupportedExtensions { get; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class UpdateSourceFolderCommand { [System.Text.Json.Serialization.JsonConstructor] - public UpdateSourceFolderCommand(System.Guid @collectionId, string? @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Guid @sourceFolderId, System.Collections.Generic.IReadOnlyCollection? @supportedExtensions) + public UpdateSourceFolderCommand(System.Guid @collectionId, string @path, bool @shouldAddTagFromFilename, bool @shouldCheckFormat, bool @shouldCheckHashFromName, bool @shouldCreateTagsFromSubfolders, System.Guid @sourceFolderId, System.Collections.Generic.IReadOnlyCollection @supportedExtensions) { @@ -2434,7 +2556,7 @@ public UpdateSourceFolderCommand(System.Guid @collectionId, string? @path, bool public System.Guid SourceFolderId { get; } [System.Text.Json.Serialization.JsonPropertyName("path")] - public string? Path { get; } + public string Path { get; } [System.Text.Json.Serialization.JsonPropertyName("shouldCheckFormat")] public bool ShouldCheckFormat { get; } @@ -2449,13 +2571,13 @@ public UpdateSourceFolderCommand(System.Guid @collectionId, string? @path, bool public bool ShouldAddTagFromFilename { get; } [System.Text.Json.Serialization.JsonPropertyName("supportedExtensions")] - public System.Collections.Generic.IReadOnlyCollection? SupportedExtensions { get; } + public System.Collections.Generic.IReadOnlyCollection SupportedExtensions { get; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WebApiException : System.Exception { public int StatusCode { get; private set; } @@ -2478,7 +2600,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WebApiException : WebApiException { public TResult Result { get; private set; } diff --git a/Tools/NSwagGeneration/DefaultService.nswag b/Tools/NSwagGeneration/DefaultService.nswag index 879c8966..43add916 100644 --- a/Tools/NSwagGeneration/DefaultService.nswag +++ b/Tools/NSwagGeneration/DefaultService.nswag @@ -56,7 +56,7 @@ "generateResponseClasses": true, "responseClass": "SwaggerResponse", "namespace": "$(ServiceName).WebApi.Client", - "requiredPropertiesMustBeDefined": false, + "requiredPropertiesMustBeDefined": true, "dateType": "System.DateTimeOffset", "jsonConverters": [], "anyType": "object", diff --git a/Tools/NukeBuild/Build.cs b/Tools/NukeBuild/Build.cs index 6ac10cc8..00ad6e83 100644 --- a/Tools/NukeBuild/Build.cs +++ b/Tools/NukeBuild/Build.cs @@ -11,7 +11,6 @@ using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.GitVersion; using static Nuke.Common.Tools.DotNet.DotNetTasks; -using static Nuke.Common.IO.FileSystemTasks; using static Z7Tasks; [CustomBuildCmdPathGitHubActions( @@ -151,7 +150,7 @@ from projectToPublish in ProjectsToPublish directoryToDelete.DeleteDirectory(); foreach (var nukeFileToPublish in NukeFilesToPublish) - CopyFileToDirectory(nukeFileToPublish, OutputLatestDirectory, FileExistsPolicy.Overwrite); + nukeFileToPublish.CopyToDirectory(OutputLatestDirectory, ExistsPolicy.FileOverwrite); return;