включен nullable-enabled для проекта AsbCloudWebApi

This commit is contained in:
Olga Nemt 2023-05-17 12:31:29 +05:00
parent 57d262d85a
commit 08501fee30
7 changed files with 7 additions and 32 deletions

View File

@ -25,7 +25,7 @@ namespace AsbCloudApp.Services
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
Task<System.Text.Json.JsonDocument> GetOrDefaultAsync(int userId, string key, CancellationToken token); Task<System.Text.Json.JsonDocument?> GetOrDefaultAsync(int userId, string key, CancellationToken token);
/// <summary> /// <summary>
/// Добавить или изменить настройки с ключем для пользователя /// Добавить или изменить настройки с ключем для пользователя

View File

@ -16,7 +16,7 @@ namespace AsbCloudInfrastructure.Repository
this.context = context; this.context = context;
} }
public Task<System.Text.Json.JsonDocument> GetOrDefaultAsync(int userId, string key, CancellationToken token) public Task<System.Text.Json.JsonDocument?> GetOrDefaultAsync(int userId, string key, CancellationToken token)
=> context.Set<UserSetting>() => context.Set<UserSetting>()
.Where(s => s.IdUser == userId && s.Key == key) .Where(s => s.IdUser == userId && s.Key == key)
.Select(s => s.Value) .Select(s => s.Value)

View File

@ -6,6 +6,7 @@
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
<NoWarn>$(NoWarn);1591</NoWarn> <NoWarn>$(NoWarn);1591</NoWarn>
<UserSecretsId>80899ceb-210f-4f19-ac56-aa90a5d666d4</UserSecretsId> <UserSecretsId>80899ceb-210f-4f19-ac56-aa90a5d666d4</UserSecretsId>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -145,7 +145,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
else else
{ {
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
(int)idWell, token).ConfigureAwait(false)) idWell!.Value, token).ConfigureAwait(false))
return Forbid(); return Forbid();
idsWells = new List<int> { (int)idWell }; idsWells = new List<int> { (int)idWell };
} }

View File

@ -19,7 +19,7 @@ namespace AsbCloudWebApi.Middlewares
{ {
try try
{ {
await next?.Invoke(context); await next.Invoke(context);
} }
catch (ArgumentInvalidException ex) catch (ArgumentInvalidException ex)
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace AsbCloudWebApi namespace AsbCloudWebApi
{ {
@ -8,7 +9,7 @@ namespace AsbCloudWebApi
{ {
public static SortedSet<string> Registered { get; } = new SortedSet<string>(); public static SortedSet<string> Registered { get; } = new SortedSet<string>();
public string Name { get; set; } public string Name { get; set; } = null!;
/// <summary> /// <summary>
/// Проверка наличия у пользователя разрешения с именем "{ControllerName}.{http_method}". /// Проверка наличия у пользователя разрешения с именем "{ControllerName}.{http_method}".

View File

@ -1,27 +0,0 @@
using System.Diagnostics;
namespace AsbCloudWebApi
{
public class TraceListenerView : TraceListener
{
public TraceListenerView()
{
Trace.Listeners.Add(this);
}
public override void Write(object o)
{
base.Write(o);
}
public override void Write(string message)
{
//throw new NotImplementedException();
}
public override void WriteLine(string message)
{
//throw new NotImplementedException();
}
}
}