From 76192003ba9c8fbb9d50fbe6e07365a45e230587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Tue, 10 Dec 2024 19:23:43 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D1=81=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=81=D0=BE=20spellchecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Persistence.API/DependencyInjection.cs | 2 +- Persistence.API/Extensions.cs | 8 +++----- .../Migrations/20241118052225_SetpointMigration.cs | 3 +-- .../Migrations/20241122074646_InitialCreate.cs | 3 +-- .../Migrations/20241126071115_Add_ChangeLog.cs | 4 +--- .../Migrations/20241202072250_TechMessageMigration.cs | 3 +-- Persistence.Repository/Extensions/EFExtensionsSortBy.cs | 4 ++-- .../Repositories/ChangeLogRepository.cs | 2 +- .../Repositories/TimeSeriesDataCachedRepository.cs | 2 +- exclusion.dic | 3 ++- 10 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Persistence.API/DependencyInjection.cs b/Persistence.API/DependencyInjection.cs index c97f4e0..123e20a 100644 --- a/Persistence.API/DependencyInjection.cs +++ b/Persistence.API/DependencyInjection.cs @@ -100,7 +100,7 @@ public static class DependencyInjection { OnMessageReceived = context => { - var accessToken = context.Request.Headers["Authorization"] + var accessToken = context.Request.Headers.Authorization .ToString() .Replace(JwtBearerDefaults.AuthenticationScheme, string.Empty) .Trim(); diff --git a/Persistence.API/Extensions.cs b/Persistence.API/Extensions.cs index a429915..5fa9fd4 100644 --- a/Persistence.API/Extensions.cs +++ b/Persistence.API/Extensions.cs @@ -8,16 +8,14 @@ public static class Extensions public static T GetUserId(this ClaimsPrincipal principal) { ArgumentNullException.ThrowIfNull(principal, nameof(principal)); - + var loggedInUserId = principal.FindFirstValue(ClaimTypes.NameIdentifier); - if (String.IsNullOrEmpty(loggedInUserId)) - throw new ArgumentNullException(nameof(loggedInUserId)); + ArgumentNullException.ThrowIfNullOrEmpty(loggedInUserId, nameof(loggedInUserId)); var result = TypeDescriptor.GetConverter(typeof(T)).ConvertFromInvariantString(loggedInUserId); - if (result is null) - throw new ArgumentNullException(nameof(result)); + ArgumentNullException.ThrowIfNull(result, nameof(result)); return (T)result; diff --git a/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs b/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs index ea6fccf..fac75d8 100644 --- a/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs +++ b/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs b/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs index dfa9396..22d31f0 100644 --- a/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs +++ b/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs b/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs index 0802b00..4750bc3 100644 --- a/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs +++ b/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs b/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs index ccf18d4..41ef8cb 100644 --- a/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs +++ b/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Repository/Extensions/EFExtensionsSortBy.cs b/Persistence.Repository/Extensions/EFExtensionsSortBy.cs index a716f43..398a3ed 100644 --- a/Persistence.Repository/Extensions/EFExtensionsSortBy.cs +++ b/Persistence.Repository/Extensions/EFExtensionsSortBy.cs @@ -44,7 +44,7 @@ public static class EFExtensionsSortBy var name = propertyInfo.Name.ToLower(); ParameterExpression arg = Expression.Parameter(type, "x"); MemberExpression property = Expression.Property(arg, propertyInfo.Name); - var selector = Expression.Lambda(property, [ arg ]); + var selector = Expression.Lambda(property, [arg]); var typeAccessor = new TypeAccessor { KeySelector = selector, @@ -200,7 +200,7 @@ public static class EFExtensionsSortBy : orderByAscending; var newQuery = (IOrderedQueryable)genericMethod - .Invoke(genericMethod, new object[] { query, lambdaExpression })!; + .Invoke(genericMethod, [query, lambdaExpression])!; return newQuery; } diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 6b9dd1e..aecb62c 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -195,7 +195,7 @@ public class ChangeLogRepository : IChangeLogRepository return datesOnly; } - private ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) + private static ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) { var entity = new ChangeLog() { diff --git a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs index c9814b1..2690c09 100644 --- a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs +++ b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs @@ -34,7 +34,7 @@ public class TimeSeriesDataCachedRepository : TimeSeriesDataRepos public override async Task> GetGtDate(DateTimeOffset dateBegin, CancellationToken token) { - if (LastData.Count() == 0 || LastData[0].Date > dateBegin) + if (LastData.Count == 0 || LastData[0].Date > dateBegin) { var dtos = await base.GetGtDate(dateBegin, token); return dtos; diff --git a/exclusion.dic b/exclusion.dic index 17113fb..9602d51 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -70,8 +70,9 @@ minidisplay oauth sbin прога -Persistance yyyyMMdd_HHmmssfff Serializers keycloak Params +Mapster +dest