Merge branch 'develop' of github.com:ONLYOFFICE/DocSpace into feature/portal-deactivation

This commit is contained in:
Viktor Fomin 2022-09-08 15:44:30 +03:00
commit ce419159b9
458 changed files with 4552 additions and 1340 deletions

View File

@ -28,19 +28,21 @@ namespace ASC.Api.Core;
public class BaseWorkerStartup
{
private readonly IConfiguration _configuration;
private readonly IHostEnvironment _hostEnvironment;
protected IConfiguration Configuration { get; }
protected IHostEnvironment HostEnvironment { get; }
protected DIHelper DIHelper { get; }
public BaseWorkerStartup(IConfiguration configuration, IHostEnvironment hostEnvironment)
{
_configuration = configuration;
_hostEnvironment = hostEnvironment;
Configuration = configuration;
HostEnvironment = hostEnvironment;
DIHelper = new DIHelper();
}
public virtual void ConfigureServices(IServiceCollection services)
{
services.AddHttpContextAccessor();
services.AddCustomHealthCheck(_configuration);
services.AddCustomHealthCheck(Configuration);
services.AddScoped<EFLoggerFactory>();
services.AddBaseDbContextPool<AccountLinkContext>();
@ -58,12 +60,22 @@ public class BaseWorkerStartup
services.AddAutoMapper(GetAutoMapperProfileAssemblies());
if (!_hostEnvironment.IsDevelopment())
if (!HostEnvironment.IsDevelopment())
{
services.AddStartupTask<WarmupServicesStartupTask>()
.TryAddSingleton(services);
}
services.AddMemoryCache();
services.AddDistributedCache(Configuration);
services.AddEventBus(Configuration);
services.AddDistributedTaskQueue();
services.AddCacheNotify(Configuration);
DIHelper.Configure(services);
}
private IEnumerable<Assembly> GetAutoMapperProfileAssemblies()

View File

@ -0,0 +1,64 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Api.Core.Extensions;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddDefaultConfiguration(
this ConfigurationManager config,
IHostEnvironment env
)
{
var path = config["pathToConf"];
if (!Path.IsPathRooted(path))
{
path = Path.GetFullPath(CrossPlatform.PathCombine(env.ContentRootPath, path));
}
config.SetBasePath(path);
config.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
});
config.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddJsonFile("storage.json")
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env.EnvironmentName}.json", true)
.AddJsonFile("rabbitmq.json")
.AddJsonFile($"rabbitmq.{env.EnvironmentName}.json", true)
.AddJsonFile("redis.json")
.AddJsonFile($"redis.{env.EnvironmentName}.json", true);
return config;
}
}

View File

@ -27,76 +27,14 @@
namespace ASC.Api.Core.Extensions;
public static class HostBuilderExtension
{
public static IHostBuilder ConfigureDefault(this IHostBuilder hostBuilder, string[] args,
Action<HostBuilderContext, IConfigurationBuilder, IHostEnvironment, string> configureApp = null,
Action<HostBuilderContext, IServiceCollection, DIHelper> configureServices = null)
{
{
public static IHostBuilder ConfigureDefault(this IHostBuilder hostBuilder)
{
hostBuilder.UseSystemd();
hostBuilder.UseWindowsService();
hostBuilder.UseServiceProviderFactory(new AutofacServiceProviderFactory());
hostBuilder.ConfigureDefaultAppConfiguration(args, configureApp);
hostBuilder.ConfigureDefaultServices(configureServices);
hostBuilder.UseServiceProviderFactory(new AutofacServiceProviderFactory());
hostBuilder.ConfigureNLogLogging();
return hostBuilder;
}
public static IHostBuilder ConfigureDefaultAppConfiguration(this IHostBuilder hostBuilder, string[] args, Action<HostBuilderContext, IConfigurationBuilder, IHostEnvironment, string> configureDelegate = null)
{
hostBuilder.ConfigureAppConfiguration((hostContext, config) =>
{
var buildedConfig = config.Build();
var path = buildedConfig["pathToConf"];
if (!Path.IsPathRooted(path))
{
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
}
var env = hostContext.HostingEnvironment;
config.SetBasePath(path);
config.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddJsonFile("storage.json")
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env.EnvironmentName}.json", true)
.AddJsonFile("rabbitmq.json")
.AddJsonFile($"rabbitmq.{env.EnvironmentName}.json", true)
.AddJsonFile("redis.json")
.AddJsonFile($"redis.{env.EnvironmentName}.json", true);
configureDelegate?.Invoke(hostContext, config, env, path);
config.AddEnvironmentVariables()
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
});
});
return hostBuilder;
}
public static IHostBuilder ConfigureDefaultServices(this IHostBuilder hostBuilder, Action<HostBuilderContext, IServiceCollection, DIHelper> configureDelegate)
{
hostBuilder.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
services.AddDistributedCache(hostContext.Configuration);
services.AddEventBus(hostContext.Configuration);
services.AddDistributedTaskQueue();
services.AddCacheNotify(hostContext.Configuration);
var diHelper = new DIHelper(services);
configureDelegate?.Invoke(hostContext, services, diHelper);
});
return hostBuilder;
return hostBuilder;
}
}

View File

@ -81,24 +81,40 @@ public static class ServiceCollectionExtension
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{
var cfg = sp.GetRequiredService<IConfiguration>();
var settings = cfg.GetSection("RabbitMQ").Get<RabbitMQSettings>();
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
var factory = new ConnectionFactory()
{
HostName = settings.HostName,
DispatchConsumersAsync = true
};
if (!string.IsNullOrEmpty(settings.UserName))
{
factory.UserName = settings.UserName;
}
if (!string.IsNullOrEmpty(settings.Password))
{
factory.Password = settings.Password;
};
if (!string.IsNullOrEmpty(rabbitMQConfiguration.EndpointUri))
{
factory.Endpoint = new AmqpTcpEndpoint(new Uri(rabbitMQConfiguration.EndpointUri));
}
else
{
factory.HostName = rabbitMQConfiguration.HostName;
factory.UserName = rabbitMQConfiguration.UserName;
factory.Password = rabbitMQConfiguration.Password;
factory.Port = rabbitMQConfiguration.Port;
factory.VirtualHost = rabbitMQConfiguration.VirtualHost;
}
if (rabbitMQConfiguration.EnableSsl)
{
factory.Ssl = new SslOption
{
Enabled = rabbitMQConfiguration.EnableSsl,
Version = SslProtocols.Tls12
};
if (!string.IsNullOrEmpty(rabbitMQConfiguration.SslCertPath))
{
factory.Ssl.CertPath = rabbitMQConfiguration.SslCertPath;
factory.Ssl.ServerName = rabbitMQConfiguration.SslServerName;
}
}
var retryCount = 5;

View File

@ -24,13 +24,15 @@
// 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 System.Security.Authentication;
namespace ASC.Common.Caching;
[Singletone]
public class RabbitMQCache<T> : IDisposable, ICacheNotify<T> where T : IMessage<T>, new()
{
private IConnection _connection;
private readonly IConnectionFactory _connectionFactory;
private readonly ConnectionFactory _factory;
private IModel _consumerChannel;
private readonly Guid _instanceId;
@ -53,14 +55,37 @@ public class RabbitMQCache<T> : IDisposable, ICacheNotify<T> where T : IMessage<
var rabbitMQConfiguration = configuration.GetSection("rabbitmq").Get<RabbitMQSettings>();
_connectionFactory = new ConnectionFactory
_factory = new ConnectionFactory();
if (!string.IsNullOrEmpty(rabbitMQConfiguration.EndpointUri))
{
HostName = rabbitMQConfiguration.HostName,
UserName = rabbitMQConfiguration.UserName,
Password = rabbitMQConfiguration.Password
};
_factory.Endpoint = new AmqpTcpEndpoint(new Uri(rabbitMQConfiguration.EndpointUri));
}
else
{
_factory.HostName = rabbitMQConfiguration.HostName;
_factory.UserName = rabbitMQConfiguration.UserName;
_factory.Password = rabbitMQConfiguration.Password;
_factory.Port = rabbitMQConfiguration.Port;
_factory.VirtualHost = rabbitMQConfiguration.VirtualHost;
}
if (rabbitMQConfiguration.EnableSsl)
{
_factory.Ssl = new SslOption
{
Enabled = rabbitMQConfiguration.EnableSsl,
Version = SslProtocols.Tls12
};
if (!string.IsNullOrEmpty(rabbitMQConfiguration.SslCertPath))
{
_factory.Ssl.CertPath = rabbitMQConfiguration.SslCertPath;
_factory.Ssl.ServerName = rabbitMQConfiguration.SslServerName;
}
}
_connection = _connectionFactory.CreateConnection();
_connection = _factory.CreateConnection();
_consumerChannel = CreateConsumerChannel();
StartBasicConsume();
@ -125,7 +150,7 @@ public class RabbitMQCache<T> : IDisposable, ICacheNotify<T> where T : IMessage<
return;
}
_connection = _connectionFactory.CreateConnection();
_connection = _factory.CreateConnection();
_connection.ConnectionShutdown += (s, e) => TryConnect();
_connection.CallbackException += (s, e) => TryConnect();
_connection.ConnectionBlocked += (s, e) => TryConnect();
@ -213,6 +238,11 @@ public class RabbitMQSettings
{
public string HostName { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Password { get; set; }
public int Port { get; set; }
public string VirtualHost { get; set; }
public string EndpointUri { get; set; }
public bool EnableSsl { get; set; }
public string SslServerName { get; set; }
public string SslCertPath { get; set; }
}

View File

@ -51,6 +51,24 @@ public static class Constants
public const string CasesModule = "cases";
public const string FilesModule = "files";
public const string FoldersModule = "folders";
public const string RoomsModule = "rooms";
#endregion
#region Products
public const string Documents = "documents";
#endregion
#region Items
public const string RoomItem = "room";
public const string SharedRoomItem = "sharedRoom";
public const string FileItem = "file";
public const string SharedFileItem = "sharedFile";
public const string FolderItem = "folder";
public const string SharedFolderItem = "sharedFolder";
#endregion
}

View File

@ -54,6 +54,7 @@ public class Feed
public string GroupId { get; set; }
public string Keywords { get; set; }
public string Id => $"{Item}_{ItemId}";
public string ContextId { get; set; }
// это значит, что новость может обновляться (пр. добавление комментариев);
// следовательно и права доступа могут устаревать

View File

@ -28,7 +28,9 @@ namespace ASC.Feed;
public class FeedApiFilter
{
public string Id { get; set; }
public string Product { get; set; }
public string Module { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public int Offset { get; set; }
@ -36,4 +38,6 @@ public class FeedApiFilter
public Guid Author { get; set; }
public string[] SearchKeys { get; set; }
public bool OnlyNew { get; set; }
}
public bool WithoutMe { get; set; }
public bool WithRelated { get; set; }
}

View File

@ -42,6 +42,7 @@ public class FeedRow
public DateTime ModifiedDate => Feed.ModifiedDate;
public string GroupId => Feed.GroupId;
public string Keywords => Feed.Keywords;
public string ContextId => Feed.ContextId;
public string Json
{
get

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
namespace ASC.Feed.Data;
[Scope]
@ -203,39 +201,51 @@ public class FeedAggregateDataProvider
private List<FeedResultItem> GetFeedsInternal(FeedApiFilter filter)
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
var q = feedDbContext.FeedAggregates
.Where(r => r.Tenant == _tenantManager.GetCurrentTenant().Id)
.Where(r => r.ModifiedBy != _authContext.CurrentAccount.ID)
.Join(feedDbContext.FeedUsers, a => a.Id, b => b.FeedId, (aggregates, users) => new { aggregates, users })
.Where(r => r.users.UserId == _authContext.CurrentAccount.ID)
var q = feedDbContext.FeedAggregates.AsNoTracking()
.Where(r => r.Tenant == _tenantManager.GetCurrentTenant().Id);
var exp = GetIdSearchExpression(filter.Id, filter.Module, filter.WithRelated);
if (exp != null)
{
q = q.Where(exp);
}
var q1 = q.Join(feedDbContext.FeedUsers, a => a.Id, b => b.FeedId, (aggregates, users) => new { aggregates, users })
.OrderByDescending(r => r.aggregates.ModifiedDate)
.Skip(filter.Offset)
.Take(filter.Max);
if (exp == null)
{
q1 = q1.Where(r => r.aggregates.ModifiedBy != _authContext.CurrentAccount.ID).
Where(r => r.users.UserId == _authContext.CurrentAccount.ID);
}
if (filter.OnlyNew)
{
q = q.Where(r => r.aggregates.AggregateDate >= filter.From);
q1 = q1.Where(r => r.aggregates.AggregateDate >= filter.From);
}
else
{
if (1 < filter.From.Year)
{
q = q.Where(r => r.aggregates.ModifiedDate >= filter.From);
q1 = q1.Where(r => r.aggregates.ModifiedDate >= filter.From);
}
if (filter.To.Year < 9999)
{
q = q.Where(r => r.aggregates.ModifiedDate <= filter.To);
q1 = q1.Where(r => r.aggregates.ModifiedDate <= filter.To);
}
}
if (!string.IsNullOrEmpty(filter.Product))
{
q = q.Where(r => r.aggregates.Product == filter.Product);
q1 = q1.Where(r => r.aggregates.Product == filter.Product);
}
if (filter.Author != Guid.Empty)
{
q = q.Where(r => r.aggregates.ModifiedBy == filter.Author);
q1 = q1.Where(r => r.aggregates.ModifiedBy == filter.Author);
}
if (filter.SearchKeys != null && filter.SearchKeys.Length > 0)
@ -245,22 +255,22 @@ public class FeedAggregateDataProvider
.Select(s => s.Replace("\\", "\\\\").Replace("%", "\\%").Replace("_", "\\_"))
.ToList();
q = q.Where(r => keys.Any(k => r.aggregates.Keywords.StartsWith(k)));
q1 = q1.Where(r => keys.Any(k => r.aggregates.Keywords.StartsWith(k)));
}
var news = q.Select(r => r.aggregates).AsEnumerable();
var news = q1.Select(r => r.aggregates).AsEnumerable();
return _mapper.Map<IEnumerable<FeedAggregate>, List<FeedResultItem>>(news);
}
public int GetNewFeedsCount(DateTime lastReadedTime, AuthContext authContext, TenantManager tenantManager)
public int GetNewFeedsCount(DateTime lastReadedTime)
{
using var feedDbContext = _dbContextFactory.CreateDbContext();
var count = feedDbContext.FeedAggregates
.Where(r => r.Tenant == tenantManager.GetCurrentTenant().Id)
.Where(r => r.ModifiedBy != authContext.CurrentAccount.ID)
.Where(r => r.Tenant == _tenantManager.GetCurrentTenant().Id)
.Where(r => r.ModifiedBy != _authContext.CurrentAccount.ID)
.Join(feedDbContext.FeedUsers, r => r.Id, u => u.FeedId, (agg, user) => new { agg, user })
.Where(r => r.user.UserId == authContext.CurrentAccount.ID);
.Where(r => r.user.UserId == _authContext.CurrentAccount.ID);
if (1 < lastReadedTime.Year)
{
@ -312,70 +322,60 @@ public class FeedAggregateDataProvider
tx.Commit();
});
}
private Expression<Func<FeedAggregate, bool>> GetIdSearchExpression(string id, string module, bool withRelated)
{
Expression<Func<FeedAggregate, bool>> exp = null;
if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(module))
{
return exp;
}
if (module == Constants.RoomsModule)
{
var roomId = $"{Constants.RoomItem}_{id}";
var sharedRoomId = $"{Constants.SharedRoomItem}_{id}";
exp = f => f.Id == roomId || f.Id.StartsWith(sharedRoomId);
if (withRelated)
{
exp = f => f.Id == roomId || f.Id.StartsWith(sharedRoomId) || f.ContextId == roomId;
}
}
if (module == Constants.FilesModule)
{
exp = f => f.Id.StartsWith($"{Constants.FileItem}_{id}") || f.Id.StartsWith($"{Constants.SharedFileItem}_{id}");
}
if (module == Constants.FoldersModule)
{
exp = f => f.Id == $"{Constants.FolderItem}_{id}" || f.Id.StartsWith($"{Constants.SharedFolderItem}_{id}");
}
return exp;
}
}
public class FeedResultItem : IMapFrom<FeedAggregate>
{
public string Json { get; private set; }
public string Module { get; private set; }
public Guid AuthorId { get; private set; }
public Guid ModifiedById { get; private set; }
public string GroupId { get; private set; }
public bool IsToday { get; private set; }
public bool IsYesterday { get; private set; }
public bool IsTomorrow { get; private set; }
public DateTime CreatedDate { get; private set; }
public DateTime ModifiedDate { get; private set; }
public DateTime AggregatedDate { get; private set; }
public FeedResultItem() { }
public FeedResultItem(
string json,
string module,
Guid authorId,
Guid modifiedById,
string groupId,
DateTime createdDate,
DateTime modifiedDate,
DateTime aggregatedDate,
TenantUtil tenantUtil)
{
var now = tenantUtil.DateTimeFromUtc(DateTime.UtcNow);
Json = json;
Module = module;
AuthorId = authorId;
ModifiedById = modifiedById;
GroupId = groupId;
var compareDate = JsonNode.Parse(Json)["IsAllDayEvent"].GetValue<bool>()
? tenantUtil.DateTimeToUtc(createdDate).Date
: createdDate.Date;
if (now.Date == compareDate.AddDays(-1))
{
IsTomorrow = true;
}
else if (now.Date == compareDate)
{
IsToday = true;
}
else if (now.Date == compareDate.AddDays(1))
{
IsYesterday = true;
}
CreatedDate = createdDate;
ModifiedDate = modifiedDate;
AggregatedDate = aggregatedDate;
}
public string Json { get; set; }
public string Module { get; set; }
public Guid AuthorId { get; set; }
public Guid ModifiedById { get; set; }
public string GroupId { get; set; }
public bool IsToday { get; set; }
public bool IsYesterday { get; set; }
public bool IsTomorrow { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public DateTime AggregatedDate { get; set; }
public void Mapping(Profile profile)
{
profile.CreateMap<FeedAggregate, FeedResultItem>()
.ConvertUsing<FeedTypeConverter>();
.AfterMap<FeedMappingAction>();
}
}
}

View File

@ -26,6 +26,7 @@
namespace ASC.Feed.Data;
[Scope]
public class FeedReadedDataProvider
{
private readonly AuthContext _authContext;

View File

@ -40,6 +40,7 @@ public class FeedAggregate : BaseEntity, IMapFrom<FeedRow>
public DateTime AggregateDate { get; set; }
public string Json { get; set; }
public string Keywords { get; set; }
public string ContextId { get; set; }
public override object[] GetKeys()
{
@ -137,6 +138,12 @@ public static class FeedAggregateExtension
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.ContextId)
.HasColumnName("context_id")
.HasColumnType("text")
.HasCharSet("utf8")
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddFeedAggregate(this ModelBuilder modelBuilder)
@ -198,6 +205,8 @@ public static class FeedAggregateExtension
.HasMaxLength(50);
entity.Property(e => e.Tenant).HasColumnName("tenant");
entity.Property(e => e.ContextId).HasColumnName("context_id");
});
}
}

View File

@ -26,6 +26,7 @@
global using System.Data;
global using System.Text.Json.Nodes;
global using System.Linq.Expressions;
global using ASC.Common;
global using ASC.Common.Mapping;
@ -46,6 +47,7 @@ global using AutoMapper;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Infrastructure;
global using Microsoft.EntityFrameworkCore.Migrations;
global using Microsoft.EntityFrameworkCore.Migrations;
global using Newtonsoft.Json;

View File

@ -26,31 +26,53 @@
namespace ASC.Feed.Mapping;
public class FeedTypeConverter : ITypeConverter<FeedAggregate, FeedResultItem>, ITypeConverter<FeedResultItem, FeedMin>
[Scope]
public class FeedMappingAction : IMappingAction<FeedAggregate, FeedResultItem>
{
private readonly TenantUtil _tenantUtil;
private readonly UserManager _userManager;
public FeedTypeConverter(TenantUtil tenantUtil, UserManager userManager)
public FeedMappingAction(TenantUtil tenantUtil)
{
_tenantUtil = tenantUtil;
_userManager = userManager;
}
public FeedResultItem Convert(FeedAggregate source, FeedResultItem destination, ResolutionContext context)
public void Process(FeedAggregate source, FeedResultItem destination, ResolutionContext context)
{
var result = new FeedResultItem(
source.Json,
source.Module,
source.Author,
source.ModifiedBy,
source.GroupId,
_tenantUtil.DateTimeFromUtc(source.CreatedDate),
_tenantUtil.DateTimeFromUtc(source.ModifiedDate),
_tenantUtil.DateTimeFromUtc(source.AggregateDate),
_tenantUtil);
var now = _tenantUtil.DateTimeFromUtc(DateTime.UtcNow);
return result;
destination.CreatedDate = _tenantUtil.DateTimeFromUtc(source.CreatedDate);
destination.ModifiedDate = _tenantUtil.DateTimeFromUtc(source.ModifiedDate);
destination.AggregatedDate = _tenantUtil.DateTimeFromUtc(source.AggregateDate);
var node = JsonNode.Parse(destination.Json)["IsAllDayEvent"];
var compareDate = node != null && node.GetValue<bool>()
? _tenantUtil.DateTimeToUtc(source.CreatedDate).Date
: destination.CreatedDate.Date;
if (now.Date == compareDate.AddDays(-1))
{
destination.IsTomorrow = true;
}
else if (now.Date == compareDate)
{
destination.IsToday = true;
}
else if (now.Date == compareDate.AddDays(1))
{
destination.IsYesterday = true;
}
}
}
[Scope]
public class FeedTypeConverter : ITypeConverter<FeedResultItem, FeedMin>
{
private readonly UserManager _userManager;
public FeedTypeConverter(UserManager userManager)
{
_userManager = userManager;
}
public FeedMin Convert(FeedResultItem source, FeedMin destination, ResolutionContext context)

View File

@ -32,7 +32,11 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args);
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.WebHost.ConfigureDefaultKestrel();
var startup = new Startup(builder.Configuration, builder.Environment);

View File

@ -0,0 +1,41 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.ClearEvents.Extensions;
public static class ServiceCollectionExtension
{
public static IServiceCollection AddClearEventsServices(this IServiceCollection services)
{
var diHelper = new DIHelper(services);
services.AddHostedService<ClearEventsService>();
diHelper.TryAdd<ClearEventsService>();
services.AddBaseDbContextPool<MessagesContext>();
return services;
}
}

View File

@ -43,3 +43,4 @@ global using Microsoft.AspNetCore.Builder;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Logging;
global using ASC.ClearEvents.Extensions;

View File

@ -32,12 +32,13 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, null, (hostContext, services, diHelper) =>
{
services.AddHostedService<ClearEventsService>();
diHelper.TryAdd<ClearEventsService>();
services.AddBaseDbContextPool<MessagesContext>();
});
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.Services.AddClearEventsServices();
builder.Host.ConfigureContainer<ContainerBuilder>((context, builder) =>
{

View File

@ -0,0 +1,41 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Data.Backup.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddBackupBackgroundTasksConfiguration(
this ConfigurationManager config,
IHostEnvironment env)
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true)
.AddJsonFile("backup.json");
return config;
}
}

View File

@ -24,6 +24,8 @@
// 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.Backup.Extension;
var options = new WebApplicationOptions
{
Args = args,
@ -31,18 +33,14 @@ var options = new WebApplicationOptions
};
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true)
.AddJsonFile("backup.json");
}, (ctx, ser, di) =>
{
ser.AddBaseDbContextPool<BackupsContext>();
ser.AddBaseDbContextPool<FilesDbContext>();
});
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddBackupBackgroundTasksConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.WebHost.ConfigureDefaultKestrel();
var startup = new Startup(builder.Configuration, builder.Environment);

View File

@ -67,7 +67,10 @@ public class Startup : BaseStartup
services.AddHostedService<BackupWorkerService>();
services.AddActivePassiveHostedService<BackupCleanerService>();
services.AddActivePassiveHostedService<BackupSchedulerService>();
services.AddActivePassiveHostedService<BackupSchedulerService>();
services.AddBaseDbContextPool<BackupsContext>();
services.AddBaseDbContextPool<FilesDbContext>();
}
}

View File

@ -0,0 +1,40 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Data.Backup.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddBackupConfiguration(
this ConfigurationManager config,
IHostEnvironment env)
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
return config;
}
}

View File

@ -24,6 +24,8 @@
// 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.Backup.Extension;
var options = new WebApplicationOptions
{
Args = args,
@ -32,15 +34,12 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
}, (ctx, ser, di) =>
{
ser.AddBaseDbContextPool<BackupsContext>();
ser.AddBaseDbContextPool<FilesDbContext>();
});
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddBackupConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.WebHost.ConfigureDefaultKestrel();

View File

@ -38,12 +38,14 @@ public class Startup : BaseStartup
{
base.ConfigureServices(services);
services.AddBaseDbContextPool<BackupsContext>();
services.AddBaseDbContextPool<FilesDbContext>();
DIHelper.TryAdd<BackupProgressItem>();
DIHelper.TryAdd<RestoreProgressItem>();
DIHelper.TryAdd<TransferProgressItem>();
NotifyConfigurationExtension.Register(DIHelper);
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@ -0,0 +1,42 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Notify.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddNotifyConfiguration(
this ConfigurationManager config,
IHostEnvironment env)
{
config.AddJsonFile($"appsettings.services.json", true)
.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
return config;
}
}

View File

@ -63,3 +63,5 @@ global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
global using Newtonsoft.Json;
global using ASC.Notify;
global using ASC.Notify.Extension;

View File

@ -32,37 +32,13 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile($"appsettings.services.json", true)
.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
},
(hostContext, services, diHelper) =>
{
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddNotifyConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
services.Configure<NotifyServiceCfg>(hostContext.Configuration.GetSection("notify"));
diHelper.TryAdd<NotifySenderService>();
diHelper.TryAdd<NotifyCleanerService>();
diHelper.TryAdd<TenantManager>();
diHelper.TryAdd<TenantWhiteLabelSettingsHelper>();
diHelper.TryAdd<SettingsManager>();
diHelper.TryAdd<JabberSender>();
diHelper.TryAdd<SmtpSender>();
diHelper.TryAdd<AWSSender>(); // fix private
diHelper.TryAdd<NotifyInvokeSendMethodRequestedIntegrationEventHandler>();
diHelper.TryAdd<NotifySendMessageRequestedIntegrationEventHandler>();
services.AddActivePassiveHostedService<NotifySenderService>();
services.AddActivePassiveHostedService<NotifyCleanerService>();
services.AddBaseDbContextPool<NotifyDbContext>();
});
var startup = new BaseWorkerStartup(builder.Configuration, builder.Environment);
var startup = new Startup(builder.Configuration, builder.Environment);
startup.ConfigureServices(builder.Services);

View File

@ -0,0 +1,60 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Notify;
public class Startup : BaseWorkerStartup
{
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) : base(configuration, hostEnvironment)
{
}
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
DIHelper.RegisterProducts(Configuration, HostEnvironment.ContentRootPath);
services.Configure<NotifyServiceCfg>(Configuration.GetSection("notify"));
DIHelper.TryAdd<NotifySenderService>();
DIHelper.TryAdd<NotifyCleanerService>();
DIHelper.TryAdd<TenantManager>();
DIHelper.TryAdd<TenantWhiteLabelSettingsHelper>();
DIHelper.TryAdd<SettingsManager>();
DIHelper.TryAdd<JabberSender>();
DIHelper.TryAdd<SmtpSender>();
DIHelper.TryAdd<AWSSender>(); // fix private
DIHelper.TryAdd<NotifyInvokeSendMethodRequestedIntegrationEventHandler>();
DIHelper.TryAdd<NotifySendMessageRequestedIntegrationEventHandler>();
services.AddActivePassiveHostedService<NotifySenderService>();
services.AddActivePassiveHostedService<NotifyCleanerService>();
services.AddBaseDbContextPool<NotifyDbContext>();
}
}

View File

@ -0,0 +1,42 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Notify.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddStudioNotifyConfiguration(
this ConfigurationManager config,
IHostEnvironment env)
{
config.AddJsonFile($"appsettings.services.json", true)
.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
return config;
}
}

View File

@ -24,6 +24,8 @@
// 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.Notify.Extension;
var options = new WebApplicationOptions
{
Args = args,
@ -32,26 +34,15 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile($"appsettings.services.json", true)
.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
},
(hostContext, services, diHelper) =>
{
services.AddHttpClient();
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
services.AddHostedService<ServiceLauncher>();
diHelper.TryAdd<ServiceLauncher>();
NotifyConfigurationExtension.Register(diHelper);
diHelper.TryAdd<EmailSenderSink>();
});
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddStudioNotifyConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.WebHost.ConfigureDefaultKestrel();
var startup = new BaseWorkerStartup(builder.Configuration, builder.Environment);
var startup = new Startup(builder.Configuration, builder.Environment);
startup.ConfigureServices(builder.Services);

View File

@ -0,0 +1,47 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
public class Startup : BaseWorkerStartup
{
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
: base(configuration, hostEnvironment)
{
}
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
services.AddHttpClient();
DIHelper.RegisterProducts(Configuration, HostEnvironment.ContentRootPath);
services.AddHostedService<ServiceLauncher>();
DIHelper.TryAdd<ServiceLauncher>();
NotifyConfigurationExtension.Register(DIHelper);
DIHelper.TryAdd<EmailSenderSink>();
}
}

View File

@ -0,0 +1,40 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.TelegramService.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddTelegramConfiguration(
this ConfigurationManager config,
IHostEnvironment env)
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
return config;
}
}

View File

@ -58,3 +58,4 @@ global using Telegram.Bot;
global using Telegram.Bot.Exceptions;
global using Telegram.Bot.Types;
global using Telegram.Bot.Types.Enums;
global using ASC.TelegramService.Extension;

View File

@ -32,11 +32,11 @@ var options = new WebApplicationOptions
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile("notify.json")
.AddJsonFile($"notify.{env.EnvironmentName}.json", true);
});
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddTelegramConfiguration(builder.Environment)
.AddEnvironmentVariables()
.AddCommandLine(args);
builder.WebHost.ConfigureDefaultKestrel();

View File

@ -0,0 +1,38 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Webhooks.Extension;
public static class ConfigurationManagerExtension
{
public static ConfigurationManager AddWebhookConfiguration(
this ConfigurationManager config)
{
config.AddJsonFile($"appsettings.services.json", true);
return config;
}
}

View File

@ -46,4 +46,6 @@ global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Logging;
global using Polly;
global using Polly.Extensions.Http;
global using Polly.Extensions.Http;
global using ASC.Webhooks.Extension;

View File

@ -31,35 +31,17 @@ var options = new WebApplicationOptions
};
var builder = WebApplication.CreateBuilder(options);
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
{
config.AddJsonFile($"appsettings.services.json", true);
}, (hostContext, services, diHelper) =>
{
services.AddHttpClient();
diHelper.TryAdd<DbWorker>();
services.AddHostedService<WorkerService>();
diHelper.TryAdd<WorkerService>();
services.AddHttpClient("webhook")
.SetHandlerLifetime(TimeSpan.FromMinutes(5))
.AddPolicyHandler((s, request) =>
{
var settings = s.GetRequiredService<Settings>();
builder.Host.ConfigureDefault();
builder.Configuration.AddDefaultConfiguration(builder.Environment)
.AddWebhookConfiguration()
.AddEnvironmentVariables()
.AddCommandLine(args);
return HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
.WaitAndRetryAsync(settings.RepeatCount.HasValue ? settings.RepeatCount.Value : 5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
});
});
builder.WebHost.ConfigureDefaultKestrel();
var startup = new BaseWorkerStartup(builder.Configuration, builder.Environment);
var startup = new Startup(builder.Configuration, builder.Environment);
startup.ConfigureServices(builder.Services);

View File

@ -0,0 +1,59 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
namespace ASC.Webhooks.Service;
public class Startup : BaseWorkerStartup
{
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) :
base(configuration, hostEnvironment)
{
}
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
services.AddHttpClient();
DIHelper.TryAdd<DbWorker>();
services.AddHostedService<WorkerService>();
DIHelper.TryAdd<WorkerService>();
services.AddHttpClient("webhook")
.SetHandlerLifetime(TimeSpan.FromMinutes(5))
.AddPolicyHandler((s, request) =>
{
var settings = s.GetRequiredService<Settings>();
return HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
.WaitAndRetryAsync(settings.RepeatCount.HasValue ? settings.RepeatCount.Value : 5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
});
}
}

View File

@ -111,7 +111,7 @@
"url": "/socket.io",
"internal": "http://localhost:9899/"
},
"cultures": "az,cs,el,es,fr,ja,lo,nl,pt,ro,sk,tr,vi,bg,de,en,fi,it,ko,lv,pl,pt-BR,ru,sl,uk,zh-CN",
"cultures": "az,cs,el-GR,es,fr,ja-JP,lo-LA,nl,pt,ro,sk,tr,vi,bg,de,en-US,en-GB,fi,it,ko-KR,lv,pl,pt-BR,ru,sl,uk-UA,zh-CN",
"url-shortener": {
"value": "/sh/",
"internal": "http://localhost:9999/"

View File

@ -85,7 +85,7 @@ server {
location / {
proxy_pass http://localhost:5001;
proxy_pass http://127.0.0.1:5001;
location ~* /(manifest.json|sw.js|appIcon(.)*\.png|icon.svg|bg-error.png|favicon.ico|debuginfo.md) {
try_files /$basename /index.html =404;
}
@ -130,7 +130,7 @@ server {
location /doceditor {
proxy_pass http://localhost:5013;
proxy_pass http://127.0.0.1:5013;
proxy_redirect off;
proxy_set_header Host $this_host;
proxy_set_header X-Real-IP $remote_addr;
@ -144,7 +144,7 @@ server {
location /login {
proxy_pass http://localhost:5011;
proxy_pass http://127.0.0.1:5011;
proxy_redirect off;
proxy_set_header Host $this_host;
proxy_set_header X-Real-IP $remote_addr;
@ -161,7 +161,7 @@ server {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:5001;
proxy_pass http://127.0.0.1:5001;
proxy_redirect off;
@ -172,24 +172,24 @@ server {
location /api/2.0 {
location ~* /(files|encryption|privacyroom) {
proxy_pass http://localhost:5007;
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(people|group) {
proxy_pass http://localhost:5004;
proxy_pass http://127.0.0.1:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty) {
proxy_pass http://localhost:5000;
location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty|feed) {
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* portal/(.*)(backup|restore)(.*) {
rewrite (.*)/portal/(.*) $1/backup/$2 break;
proxy_redirect off;
proxy_pass http://localhost:5012;
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
@ -197,39 +197,39 @@ server {
rewrite (.*)/authentication/register(.*) $1/people/register$2 break;
proxy_redirect off;
proxy_pass http://localhost:5004;
proxy_pass http://127.0.0.1:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
location ~* /backup {
proxy_pass http://localhost:5012;
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /plugins {
proxy_pass http://localhost:5014;
proxy_pass http://127.0.0.1:5014;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /migration {
proxy_pass http://localhost:5034;
proxy_pass http://127.0.0.1:5034;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
location /sso {
rewrite sso/(.*) /$1 break;
proxy_pass http://localhost:9834;
proxy_pass http://127.0.0.1:9834;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(ssologin.ashx|login.ashx|storage) {
proxy_pass http://localhost:5003;
proxy_pass http://127.0.0.1:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /socket.io/ {
proxy_pass http://localhost:9899;
proxy_pass http://127.0.0.1:9899;
proxy_redirect off;
proxy_http_version 1.1;
@ -243,19 +243,19 @@ server {
}
location /backupFileUpload.ashx {
proxy_pass http://localhost:5012;
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /ThirdPartyApp {
proxy_pass http://localhost:5007;
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /products {
location ~* /files {
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
proxy_pass http://localhost:5007;
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
@ -263,13 +263,13 @@ server {
location /apisystem {
rewrite apisystem/(.*) /$1 break;
proxy_pass http://localhost:5010;
proxy_pass http://127.0.0.1:5010;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /sh {
rewrite sh/(.*) /$1 break;
proxy_pass http://localhost:9999;
proxy_pass http://127.0.0.1:9999;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

View File

@ -58,7 +58,7 @@ server {
rewrite ^ /appserver$request_uri? redirect;
}
proxy_pass http://localhost:8081;
proxy_pass http://127.0.0.1:8081;
root /usr/share/nginx/html;
index index.html index.htm;
@ -70,7 +70,7 @@ server {
rewrite /appserver(.*) $1 break;
proxy_pass http://localhost:8092;
proxy_pass http://127.0.0.1:8092;
proxy_set_header Accept-Encoding "";
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

View File

@ -55,12 +55,12 @@ server {
}
if ($mobile_rewrite = perform) {
proxy_pass http://localhost:8092;
proxy_pass http://127.0.0.1:8092;
break;
}
proxy_pass http://localhost:8081;
proxy_pass http://127.0.0.1:8081;
root /usr/share/nginx/html;
index index.html index.htm;

View File

@ -2,6 +2,8 @@
"RabbitMQ": {
"Hostname": "localhost",
"UserName": "guest",
"Password": "guest"
"Password": "guest",
"Port": 5672,
"VirtualHost": "/"
}
}

View File

@ -2,6 +2,12 @@
"RabbitMQ": {
"Hostname": "localhost",
"UserName": "guest",
"Password": "guest"
}
"Password": "guest",
"Port": 5672,
"VirtualHost": "/",
"EndpointUri": "",
"EnableSsl": false,
"SslServerName": "",
"SslCertPath": ""
}
}

View File

@ -0,0 +1,194 @@
// <auto-generated />
using System;
using ASC.Feed.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace ASC.Migrations.MySql.Migrations.FeedDb
{
[DbContext(typeof(FeedDbContext))]
[Migration("20220831152410_FeedDbContext_Upgrade1")]
partial class FeedDbContext_Upgrade1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("ASC.Feed.Model.FeedAggregate", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(88)")
.HasColumnName("id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("AggregateDate")
.HasColumnType("datetime")
.HasColumnName("aggregated_date");
b.Property<string>("Author")
.IsRequired()
.HasColumnType("char(38)")
.HasColumnName("author")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("ContextId")
.HasColumnType("text")
.HasColumnName("context_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime")
.HasColumnName("created_date");
b.Property<string>("GroupId")
.HasColumnType("varchar(70)")
.HasColumnName("group_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("Json")
.IsRequired()
.HasColumnType("mediumtext")
.HasColumnName("json")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("Keywords")
.HasColumnType("text")
.HasColumnName("keywords")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("char(38)")
.HasColumnName("modified_by")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("ModifiedDate")
.HasColumnType("datetime")
.HasColumnName("modified_date");
b.Property<string>("Module")
.IsRequired()
.HasColumnType("varchar(50)")
.HasColumnName("module")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("Product")
.IsRequired()
.HasColumnType("varchar(50)")
.HasColumnName("product")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<int>("Tenant")
.HasColumnType("int")
.HasColumnName("tenant");
b.HasKey("Id");
b.HasIndex("Tenant", "AggregateDate")
.HasDatabaseName("aggregated_date");
b.HasIndex("Tenant", "ModifiedDate")
.HasDatabaseName("modified_date");
b.HasIndex("Tenant", "Product")
.HasDatabaseName("product");
b.ToTable("feed_aggregate", (string)null);
b.HasAnnotation("MySql:CharSet", "utf8");
});
modelBuilder.Entity("ASC.Feed.Model.FeedLast", b =>
{
b.Property<string>("LastKey")
.HasColumnType("varchar(128)")
.HasColumnName("last_key")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("LastDate")
.HasColumnType("datetime")
.HasColumnName("last_date");
b.HasKey("LastKey")
.HasName("PRIMARY");
b.ToTable("feed_last", (string)null);
b.HasAnnotation("MySql:CharSet", "utf8");
});
modelBuilder.Entity("ASC.Feed.Model.FeedReaded", b =>
{
b.Property<int>("Tenant")
.HasColumnType("int")
.HasColumnName("tenant_id");
b.Property<string>("UserId")
.HasColumnType("varchar(38)")
.HasColumnName("user_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("Module")
.HasColumnType("varchar(50)")
.HasColumnName("module")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("TimeStamp")
.HasColumnType("datetime")
.HasColumnName("timestamp");
b.HasKey("Tenant", "UserId", "Module")
.HasName("PRIMARY");
b.ToTable("feed_readed", (string)null);
b.HasAnnotation("MySql:CharSet", "utf8");
});
modelBuilder.Entity("ASC.Feed.Model.FeedUsers", b =>
{
b.Property<string>("FeedId")
.HasColumnType("varchar(88)")
.HasColumnName("feed_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("UserId")
.HasColumnType("char(38)")
.HasColumnName("user_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.HasKey("FeedId", "UserId")
.HasName("PRIMARY");
b.HasIndex("UserId")
.HasDatabaseName("user_id");
b.ToTable("feed_users", (string)null);
b.HasAnnotation("MySql:CharSet", "utf8");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.MySql.Migrations.FeedDb
{
public partial class FeedDbContext_Upgrade1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "context_id",
table: "feed_aggregate",
type: "text",
nullable: true,
collation: "utf8_general_ci")
.Annotation("MySql:CharSet", "utf8");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "context_id",
table: "feed_aggregate");
}
}
}

View File

@ -16,7 +16,7 @@ namespace ASC.Migrations.MySql.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.4")
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("ASC.Feed.Model.FeedAggregate", b =>
@ -38,6 +38,12 @@ namespace ASC.Migrations.MySql.Migrations
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<string>("ContextId")
.HasColumnType("text")
.HasColumnName("context_id")
.UseCollation("utf8_general_ci")
.HasAnnotation("MySql:CharSet", "utf8");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime")
.HasColumnName("created_date");

View File

@ -0,0 +1,174 @@
// <auto-generated />
using System;
using ASC.Feed.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ASC.Migrations.PostgreSql.Migrations.FeedDb
{
[DbContext(typeof(FeedDbContext))]
[Migration("20220831152410_FeedDbContext_Upgrade1")]
partial class FeedDbContext_Upgrade1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("ASC.Feed.Model.FeedAggregate", b =>
{
b.Property<string>("Id")
.HasMaxLength(88)
.HasColumnType("character varying(88)")
.HasColumnName("id");
b.Property<DateTime>("AggregateDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("aggregated_date");
b.Property<Guid>("Author")
.HasMaxLength(38)
.HasColumnType("uuid")
.HasColumnName("author")
.IsFixedLength();
b.Property<string>("ContextId")
.HasColumnType("text")
.HasColumnName("context_id");
b.Property<DateTime>("CreatedDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_date");
b.Property<string>("GroupId")
.ValueGeneratedOnAdd()
.HasMaxLength(70)
.HasColumnType("character varying(70)")
.HasColumnName("group_id")
.HasDefaultValueSql("NULL");
b.Property<string>("Json")
.IsRequired()
.HasColumnType("text")
.HasColumnName("json");
b.Property<string>("Keywords")
.HasColumnType("text")
.HasColumnName("keywords");
b.Property<Guid>("ModifiedBy")
.HasMaxLength(38)
.HasColumnType("uuid")
.HasColumnName("modified_by")
.IsFixedLength();
b.Property<DateTime>("ModifiedDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("modified_date");
b.Property<string>("Module")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("module");
b.Property<string>("Product")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("product");
b.Property<int>("Tenant")
.HasColumnType("integer")
.HasColumnName("tenant");
b.HasKey("Id");
b.HasIndex("Tenant", "AggregateDate")
.HasDatabaseName("aggregated_date");
b.HasIndex("Tenant", "ModifiedDate")
.HasDatabaseName("modified_date");
b.HasIndex("Tenant", "Product")
.HasDatabaseName("product");
b.ToTable("feed_aggregate", "onlyoffice");
});
modelBuilder.Entity("ASC.Feed.Model.FeedLast", b =>
{
b.Property<string>("LastKey")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasColumnName("last_key");
b.Property<DateTime>("LastDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_date");
b.HasKey("LastKey")
.HasName("feed_last_pkey");
b.ToTable("feed_last", "onlyoffice");
});
modelBuilder.Entity("ASC.Feed.Model.FeedReaded", b =>
{
b.Property<Guid>("UserId")
.HasMaxLength(38)
.HasColumnType("uuid")
.HasColumnName("user_id");
b.Property<int>("Tenant")
.HasColumnType("integer")
.HasColumnName("tenant_id");
b.Property<string>("Module")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("module");
b.Property<DateTime>("TimeStamp")
.HasColumnType("timestamp with time zone")
.HasColumnName("timestamp");
b.HasKey("UserId", "Tenant", "Module")
.HasName("feed_readed_pkey");
b.ToTable("feed_readed", "onlyoffice");
});
modelBuilder.Entity("ASC.Feed.Model.FeedUsers", b =>
{
b.Property<string>("FeedId")
.HasMaxLength(88)
.HasColumnType("character varying(88)")
.HasColumnName("feed_id");
b.Property<Guid>("UserId")
.HasMaxLength(38)
.HasColumnType("uuid")
.HasColumnName("user_id")
.IsFixedLength();
b.HasKey("FeedId", "UserId")
.HasName("feed_users_pkey");
b.HasIndex("UserId")
.HasDatabaseName("user_id_feed_users");
b.ToTable("feed_users", "onlyoffice");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ASC.Migrations.PostgreSql.Migrations.FeedDb
{
public partial class FeedDbContext_Upgrade1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "context_id",
schema: "onlyoffice",
table: "feed_aggregate",
type: "text",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "context_id",
schema: "onlyoffice",
table: "feed_aggregate");
}
}
}

View File

@ -18,7 +18,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "6.0.4")
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("ASC.Feed.Model.FeedAggregate", b =>
@ -38,6 +38,10 @@ namespace ASC.Migrations.PostgreSql.Migrations
.HasColumnName("author")
.IsFixedLength();
b.Property<string>("ContextId")
.HasColumnType("text")
.HasColumnName("context_id");
b.Property<DateTime>("CreatedDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_date");

Some files were not shown because too many files have changed in this diff Show More