fix usings

This commit is contained in:
pavelbannov 2022-05-24 18:41:28 +03:00
parent 02570e12cf
commit b525696b03
19 changed files with 80 additions and 98 deletions

View File

@ -24,7 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using Microsoft.Extensions.Primitives;
namespace ASC.Common.Caching;

View File

@ -32,7 +32,6 @@ global using System.Globalization;
global using System.Net;
global using System.Net.Mail;
global using System.Reflection;
global using System.Runtime.Caching;
global using System.Runtime.CompilerServices;
global using System.Runtime.Loader;
global using System.Runtime.Serialization;
@ -89,6 +88,7 @@ global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.DependencyInjection.Extensions;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
global using Microsoft.Extensions.Primitives;
global using Microsoft.Net.Http.Headers;
global using Newtonsoft.Json;
@ -105,4 +105,4 @@ global using ProtoBuf;
global using RabbitMQ.Client;
global using RabbitMQ.Client.Events;
global using StackExchange.Redis.Extensions.Core.Abstractions;
global using StackExchange.Redis.Extensions.Core.Abstractions;

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ProtoBuf;
namespace ASC.Core.Encryption;
[ProtoContract]

View File

@ -37,7 +37,6 @@ global using System.Linq.Expressions;
global using System.Net;
global using System.Reflection;
global using System.Resources;
global using System.Runtime.Caching;
global using System.Runtime.Serialization;
global using System.Security;
global using System.Security.Authentication;
@ -83,6 +82,7 @@ global using ASC.Core.Common.EF.Model.Resource;
global using ASC.Core.Common.Hosting.Extensions;
global using ASC.Core.Common.Hosting.Interfaces;
global using ASC.Core.Common.Notify;
global using ASC.Core.Common.Notify.IntegrationEvents.Events;
global using ASC.Core.Common.Notify.Jabber;
global using ASC.Core.Common.Notify.Push;
global using ASC.Core.Common.Notify.Telegram;
@ -97,6 +97,8 @@ global using ASC.Core.Security.Authentication;
global using ASC.Core.Security.Authorizing;
global using ASC.Core.Tenants;
global using ASC.Core.Users;
global using ASC.EventBus.Abstractions;
global using ASC.EventBus.Events;
global using ASC.Notify;
global using ASC.Notify.Channels;
global using ASC.Notify.Cron;
@ -123,6 +125,7 @@ global using Microsoft.EntityFrameworkCore.Metadata;
global using Microsoft.EntityFrameworkCore.Migrations;
global using Microsoft.EntityFrameworkCore.Query;
global using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
global using Microsoft.Extensions.Caching.Memory;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
@ -136,10 +139,8 @@ global using Newtonsoft.Json;
global using NVelocity;
global using NVelocity.App.Events;
global using ProtoBuf;
global using Telegram.Bot;
global using static ASC.Security.Cryptography.EmailValidationKeyProvider;
global using ASC.Core.Common.Notify.IntegrationEvents.Events;
global using ASC.EventBus.Abstractions;
global using Microsoft.Extensions.Caching.Memory;

View File

@ -24,9 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.EventBus.Events;
using ProtoBuf;
namespace ASC.Core.Common.Notify.IntegrationEvents.Events;
[ProtoContract]

View File

@ -24,9 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.EventBus.Events;
using ProtoBuf;
namespace ASC.Core.Common.Notify.IntegrationEvents.Events;
[ProtoContract]

View File

@ -24,9 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.EventBus.Events;
using ProtoBuf;
namespace ASC.Core.Common.Notify.IntegrationEvents.Events;
[ProtoContract]

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ProtoBuf;
namespace ASC.Notify.Messages;
[ProtoContract]

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ProtoBuf;
namespace ASC.Notify.Messages;
[ProtoContract]

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ProtoBuf;
namespace ASC.Notify.Messages;
[ProtoContract]

View File

@ -24,26 +24,16 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.Data.Storage.Encryption.IntegrationEvents.Events;
using ASC.EventBus.Abstractions;
namespace ASC.Notify.IntegrationEvents.EventHandling;
[Scope]
public class EncryptionDataStorageRequestedIntegrationEventHandler : IIntegrationEventHandler<EncryptionDataStorageRequestedIntegration>
{
private readonly ILog _logger;
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly EncryptionWorker _encryptionWorker;
public EncryptionDataStorageRequestedIntegrationEventHandler(
IOptionsMonitor<ILog> logger,
EncryptionWorker encryptionWorker,
IServiceScopeFactory serviceScopeFactory)
public EncryptionDataStorageRequestedIntegrationEventHandler(EncryptionWorker encryptionWorker)
{
_logger = logger.CurrentValue;
_encryptionWorker = encryptionWorker;
_serviceScopeFactory = serviceScopeFactory;
}
public async Task Handle(EncryptionDataStorageRequestedIntegration @event)

View File

@ -24,11 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.EventBus.Events;
using ProtoBuf;
namespace ASC.Data.Storage.Encryption.IntegrationEvents.Events;
[ProtoContract]

View File

@ -34,7 +34,7 @@ global using System.Text;
global using System.Text.Json;
global using System.Text.Json.Serialization;
global using System.Web;
global using Amazon;
global using Amazon.CloudFront;
global using Amazon.CloudFront.Model;
@ -42,7 +42,7 @@ global using Amazon.S3;
global using Amazon.S3.Model;
global using Amazon.S3.Transfer;
global using Amazon.Util;
global using ASC.Common;
global using ASC.Common.Caching;
global using ASC.Common.Logging;
@ -59,16 +59,19 @@ global using ASC.Data.Storage;
global using ASC.Data.Storage.Configuration;
global using ASC.Data.Storage.DiscStorage;
global using ASC.Data.Storage.Encryption;
global using ASC.Data.Storage.Encryption.IntegrationEvents.Events;
global using ASC.Data.Storage.GoogleCloud;
global using ASC.Data.Storage.RackspaceCloud;
global using ASC.Data.Storage.S3;
global using ASC.EventBus.Abstractions;
global using ASC.EventBus.Events;
global using ASC.Notify.Messages;
global using ASC.Protos.Migration;
global using ASC.Security.Cryptography;
global using Google.Apis.Auth.OAuth2;
global using Google.Cloud.Storage.V1;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.Http;
@ -77,11 +80,12 @@ global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Options;
global using net.openstack.Core.Domain;
global using net.openstack.Providers.Rackspace;
global using ProtoBuf;
global using static Google.Cloud.Storage.V1.UrlSigner;
global using MimeMapping = ASC.Common.Web.MimeMapping;
global using MimeMapping = ASC.Common.Web.MimeMapping;

View File

@ -41,17 +41,17 @@ global using ASC.Data.Backup.IntegrationEvents.EventHandling;
global using ASC.Data.Backup.Services;
global using ASC.Data.Backup.Storage;
global using ASC.EventBus.Abstractions;
global using ASC.EventBus.Events;
global using ASC.Files.Core;
global using ASC.Web.Studio.Core.Notify;
global using Autofac;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Options;
global using Newtonsoft.Json;
global using ASC.EventBus.Events;

View File

@ -30,7 +30,6 @@ global using System.Reflection;
global using ASC.Api.Core;
global using ASC.Api.Core.Extensions;
global using ASC.Common;
global using ASC.Common.Caching;
global using ASC.Common.DependencyInjection;
global using ASC.Common.Logging;
global using ASC.Common.Mapping;
@ -38,9 +37,14 @@ global using ASC.Core;
global using ASC.Core.Common.EF;
global using ASC.Core.Common.EF.Context;
global using ASC.Core.Common.EF.Model;
global using ASC.Core.Common.Hosting;
global using ASC.Core.Common.Hosting.Interfaces;
global using ASC.Core.Common.Notify.IntegrationEvents.Events;
global using ASC.Core.Common.Settings;
global using ASC.Core.Notify.Senders;
global using ASC.EventBus.Abstractions;
global using ASC.Notify.Config;
global using ASC.Notify.IntegrationEvents.EventHandling;
global using ASC.Notify.Messages;
global using ASC.Notify.Services;
global using ASC.Web.Core.WhiteLabel;
@ -50,20 +54,9 @@ global using Autofac;
global using AutoMapper;
global using Google.Protobuf.Collections;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Options;
global using Newtonsoft.Json;
global using ASC.EventBus.Abstractions;
global using ASC.EventBus.Events;
global using ASC.Notify.IntegrationEvents.EventHandling;
global using ASC.Core.Common.Notify.IntegrationEvents.Events;
global using ASC.Core.Common.Hosting;
global using ASC.Core.Common.Hosting.Interfaces;
global using Newtonsoft.Json;

View File

@ -26,9 +26,8 @@
global using System.Net;
global using System.Reflection;
global using System.Runtime.Caching;
global using System.Text.RegularExpressions;
global using ASC.Api.Core;
global using ASC.Api.Core.Extensions;
global using ASC.Common;
@ -37,25 +36,23 @@ global using ASC.Common.Logging;
global using ASC.Core;
global using ASC.Core.Common.Configuration;
global using ASC.Core.Common.Notify;
global using ASC.Core.Common.Notify.IntegrationEvents.Events;
global using ASC.Core.Common.Notify.Telegram;
global using ASC.EventBus.Abstractions;
global using ASC.FederatedLogin.LoginProviders;
global using ASC.Notify.Messages;
global using ASC.TelegramService;
global using ASC.TelegramService.Core;
global using ASC.TelegramService.IntegrationEvents.EventHandling;
global using Autofac;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.Extensions.Caching.Distributed;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Options;
global using Telegram.Bot;
global using Telegram.Bot.Args;
global using Telegram.Bot.Types;
global using ASC.EventBus.Abstractions;
global using ASC.TelegramService.IntegrationEvents.EventHandling;
global using Telegram.Bot.Exceptions;
global using Telegram.Bot.Types;
global using Telegram.Bot.Types.Enums;
global using Microsoft.Extensions.Caching.Distributed;

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.Core.Common.Notify.IntegrationEvents.Events;
namespace ASC.TelegramService.IntegrationEvents.EventHandling;
[Scope]

View File

@ -33,11 +33,11 @@ public class TelegramHandler
private readonly CommandModule _command;
private readonly ILog _log;
private readonly IServiceScopeFactory _scopeFactory;
private readonly IDistributedCache _distributedCache;
private readonly IDistributedCache _distributedCache;
public TelegramHandler(IDistributedCache distributedCache,
CommandModule command,
IOptionsMonitor<ILog> option,
CommandModule command,
IOptionsMonitor<ILog> option,
IServiceScopeFactory scopeFactory)
{
_command = command;
@ -51,9 +51,16 @@ public class TelegramHandler
public async Task SendMessage(NotifyMessage msg)
{
if (string.IsNullOrEmpty(msg.Reciever)) return;
if (!_clients.ContainsKey(msg.TenantId)) return;
if (string.IsNullOrEmpty(msg.Reciever))
{
return;
}
if (!_clients.ContainsKey(msg.TenantId))
{
return;
}
var scope = _scopeFactory.CreateScope();
var telegramDao = scope.ServiceProvider.GetService<TelegramDao>();
@ -81,8 +88,11 @@ public class TelegramHandler
public void DisableClient(int tenantId)
{
if (!_clients.ContainsKey(tenantId)) return;
if (!_clients.ContainsKey(tenantId))
{
return;
}
var client = _clients[tenantId];
if (client.CancellationTokenSource != null)
@ -163,8 +173,8 @@ public class TelegramHandler
var dateExpires = DateTimeOffset.Now.AddMinutes(_clients[tenantId].TokenLifeSpan);
_distributedCache.SetString(token, userKey, new DistributedCacheEntryOptions
{
AbsoluteExpiration = dateExpires
{
AbsoluteExpiration = dateExpires
});
}
@ -183,10 +193,21 @@ public class TelegramHandler
async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken, int tenantId)
{
if (update.Type != UpdateType.Message) return;
if (update.Message.Type != MessageType.Text) return;
if (String.IsNullOrEmpty(update.Message.Text) || update.Message.Text[0] != '/') return;
if (update.Type != UpdateType.Message)
{
return;
}
if (update.Message.Type != MessageType.Text)
{
return;
}
if (String.IsNullOrEmpty(update.Message.Text) || update.Message.Text[0] != '/')
{
return;
}
await _command.HandleCommand(update.Message, botClient, tenantId);
}

View File

@ -76,6 +76,7 @@ global using ASC.Data.Storage;
global using ASC.ElasticSearch;
global using ASC.ElasticSearch.Core;
global using ASC.ElasticSearch.Service;
global using ASC.EventBus.Events;
global using ASC.FederatedLogin;
global using ASC.FederatedLogin.Helpers;
global using ASC.FederatedLogin.LoginProviders;
@ -86,6 +87,7 @@ global using ASC.Files.Core.ApiModels.ResponseDto;
global using ASC.Files.Core.Core.Entries;
global using ASC.Files.Core.Data;
global using ASC.Files.Core.EF;
global using ASC.Files.Core.IntegrationEvents.Events;
global using ASC.Files.Core.Mapping;
global using ASC.Files.Core.Resources;
global using ASC.Files.Core.Security;
@ -186,6 +188,8 @@ global using Nest;
global using Newtonsoft.Json;
global using Newtonsoft.Json.Linq;
global using ProtoBuf;
global using static ASC.Files.Core.Data.AbstractDao;
global using static ASC.Web.Core.Files.DocumentService;
global using static ASC.Web.Files.Services.DocumentService.DocumentServiceTracker;
@ -211,6 +215,3 @@ global using JsonTokenType = System.Text.Json.JsonTokenType;
global using JsonConverter = System.Text.Json.Serialization.JsonConverter;
global using JsonConverterAttribute = System.Text.Json.Serialization.JsonConverterAttribute;
global using JsonIgnoreAttribute = System.Text.Json.Serialization.JsonIgnoreAttribute;
global using ASC.EventBus.Events;
global using ProtoBuf;
global using ASC.Files.Core.IntegrationEvents.Events;