From ee2d4ba8bd9b14e21f9eee9fb3fa254f74566559 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Mon, 5 Jan 2026 10:54:57 +0300 Subject: [PATCH 1/8] Initial WorkGroup support to Xchange processing and caching --- SW.Bitween.Api/Data/BitweenDbContext.cs | 26 +++++++- .../Domain/Subscription/Subscription.cs | 2 + .../Domain/Subscription/WorkGroup.cs | 10 +++ SW.Bitween.Api/Domain/Xchange/Xchange.cs | 11 ++-- .../Domain/Xchange/XchangeCreatedEvent.cs | 7 ++- .../Extensions/InfolinkDbContextExtensions.cs | 4 ++ SW.Bitween.Api/Interfaces/IInfolinkCache.cs | 2 + .../Resources/Xchanges/BulkRetry.cs | 9 ++- SW.Bitween.Api/Resources/Xchanges/Create.cs | 2 +- SW.Bitween.Api/Resources/Xchanges/Retry.cs | 8 +-- SW.Bitween.Api/Resources/Xchanges/Update.cs | 2 +- .../Services/Caching/InMemoryInfolinkCache.cs | 62 +++++++++++++------ SW.Bitween.Api/Services/XchangeService.cs | 37 +++++++---- 13 files changed, 136 insertions(+), 46 deletions(-) create mode 100644 SW.Bitween.Api/Domain/Subscription/WorkGroup.cs diff --git a/SW.Bitween.Api/Data/BitweenDbContext.cs b/SW.Bitween.Api/Data/BitweenDbContext.cs index 3b0b9e86..eecdcd96 100644 --- a/SW.Bitween.Api/Data/BitweenDbContext.cs +++ b/SW.Bitween.Api/Data/BitweenDbContext.cs @@ -302,8 +302,30 @@ async public override Task SaveChangesAsync(CancellationToken cancellationT ChangeTracker.ApplyAuditValues(requestContext.GetNameIdentifier()); //using var transaction = await Database.BeginTransactionAsync(); var affectedRecords = await base.SaveChangesAsync(cancellationToken); - await ChangeTracker.PublishDomainEvents(publish); - //await transaction.CommitAsync(); + //await ChangeTracker.PublishDomainEvents(publish); + var entitiesWithEvents = ChangeTracker.Entries() + .Select(e => e.Entity) + .Where(e => e.Events.Any()) + .ToArray(); + + foreach (var entity in entitiesWithEvents) + { + var events = entity.Events.ToArray(); + entity.Events.Clear(); + foreach (var domainEvent in events) + { + if(domainEvent is XchangeCreatedEvent xchangeCreatedEvent) + { + + await publish.Publish(domainEvent.GetType().Name, JsonConvert.SerializeObject(new XchangeCreatedMessage{Id = xchangeCreatedEvent.Id})); + } + else + await publish.Publish(domainEvent.GetType().Name, JsonConvert.SerializeObject(domainEvent)); + } + } + + + return affectedRecords; } } diff --git a/SW.Bitween.Api/Domain/Subscription/Subscription.cs b/SW.Bitween.Api/Domain/Subscription/Subscription.cs index 99cfe9ce..deed91d0 100644 --- a/SW.Bitween.Api/Domain/Subscription/Subscription.cs +++ b/SW.Bitween.Api/Domain/Subscription/Subscription.cs @@ -59,6 +59,8 @@ private Subscription(string name, int documentId, SubscriptionType type, int? pa public int? PartnerId { get; private set; } public int? CategoryId { get; set; } public SubscriptionCategory Category { get; set; } + public int? WorkGroupId { get; set; } + public WorkGroup WorkGroup { get; set; } public bool Temporary { get; private set; } public DateTime? PausedOn { get; private set; } public string ValidatorId { get; set; } diff --git a/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs b/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs new file mode 100644 index 00000000..9b64a525 --- /dev/null +++ b/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs @@ -0,0 +1,10 @@ +using SW.PrimitiveTypes; + +namespace SW.Bitween.Domain; + +public class WorkGroup : BaseEntity +{ + public string Name { get; set; } + public string BusMessageName { get; set; } + public static WorkGroup None => new() { BusMessageName = "Ungrouped"}; +} \ No newline at end of file diff --git a/SW.Bitween.Api/Domain/Xchange/Xchange.cs b/SW.Bitween.Api/Domain/Xchange/Xchange.cs index 30ae66f2..d78d3a37 100644 --- a/SW.Bitween.Api/Domain/Xchange/Xchange.cs +++ b/SW.Bitween.Api/Domain/Xchange/Xchange.cs @@ -11,7 +11,7 @@ private Xchange() { } - public Xchange(int documentId, XchangeFile file, string[] references = null, SubscriptionType subscriptionType = SubscriptionType.Internal, string correlationId = null) + public Xchange(int documentId, WorkGroup workGroup, XchangeFile file, string[] references = null, SubscriptionType subscriptionType = SubscriptionType.Internal, string correlationId = null) { Id = Guid.NewGuid().ToString("N"); DocumentId = documentId; @@ -34,11 +34,12 @@ public Xchange(int documentId, XchangeFile file, string[] references = null, Sub }; xchangeEvent.Id = Id; + xchangeEvent.WorkGroup = workGroup ?? WorkGroup.None; Events.Add(xchangeEvent); } public Xchange(Subscription subscription, XchangeFile file, string[] references = null, string correlationId = null) : - this(subscription.DocumentId, file, references, subscription.Type) + this(subscription.DocumentId, subscription.WorkGroup, file, references, subscription.Type) { SubscriptionId = subscription.Id; MapperId = subscription.MapperId; @@ -51,8 +52,8 @@ public Xchange(Subscription subscription, XchangeFile file, string[] references } //retry xchange - public Xchange(Xchange xchange, XchangeFile file) : - this(xchange.DocumentId, file, xchange.References) + public Xchange(Xchange xchange, XchangeFile file,WorkGroup workGroup) : + this(xchange.DocumentId,workGroup, file, xchange.References) { SubscriptionId = xchange.SubscriptionId; MapperId = xchange.MapperId; @@ -65,7 +66,7 @@ public Xchange(Xchange xchange, XchangeFile file) : } //retry with reset subscription properties public Xchange(Subscription subscription, Xchange xchange, XchangeFile file) : - this(xchange.DocumentId, file, xchange.References) + this(xchange.DocumentId,subscription.WorkGroup, file, xchange.References) { SubscriptionId = xchange.SubscriptionId; MapperId = subscription.MapperId; diff --git a/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs b/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs index 50699c54..b5c8e51f 100644 --- a/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs +++ b/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs @@ -3,12 +3,17 @@ namespace SW.Bitween.Domain { + internal abstract class XchangeCreatedEvent : BaseDomainEvent { public string Id { get; set; } + public WorkGroup WorkGroup { get; set; } } - + internal class XchangeCreatedMessage:XchangeCreatedEvent + { + + } internal class ApiXchangeCreatedEvent : XchangeCreatedEvent { } diff --git a/SW.Bitween.Api/Extensions/InfolinkDbContextExtensions.cs b/SW.Bitween.Api/Extensions/InfolinkDbContextExtensions.cs index 0f21abd8..ce90241c 100644 --- a/SW.Bitween.Api/Extensions/InfolinkDbContextExtensions.cs +++ b/SW.Bitween.Api/Extensions/InfolinkDbContextExtensions.cs @@ -27,5 +27,9 @@ where partner.ApiCredentials.Any(cred => cred.Key == partnerKey) return (par, par.ApiCredentials.First(c => c.Key == partnerKey).Name); } + + public static IQueryable Subscriptions(this BitweenDbContext dbContext) => + dbContext.Set().Include(s => s.WorkGroup); } + } \ No newline at end of file diff --git a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs index ebdbec60..9ed002d3 100644 --- a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs +++ b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs @@ -16,4 +16,6 @@ public interface IInfolinkCache void Revoke(); void BroadcastRevoke(); + Task ListWorkGroupsAsync(); + Task WorkGroupByIdAsync(int workGroupId); } \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/Xchanges/BulkRetry.cs b/SW.Bitween.Api/Resources/Xchanges/BulkRetry.cs index 503e66d4..7ff64e52 100644 --- a/SW.Bitween.Api/Resources/Xchanges/BulkRetry.cs +++ b/SW.Bitween.Api/Resources/Xchanges/BulkRetry.cs @@ -9,7 +9,7 @@ namespace SW.Bitween.Resources.Xchanges { [HandlerName("bulkretry")] - public class BulkRetry : ICommandHandler + public class BulkRetry : ICommandHandler { private readonly BitweenDbContext _dbContext; private readonly XchangeService _xchangeService; @@ -30,9 +30,11 @@ public async Task Handle(XchangeBulkRetry request) { var inputFileData = await _xchangeService.GetFile(xchange.Id, XchangeFileType.Input); var xchangeFile = new XchangeFile(inputFileData, xchange.InputName); + var subscription = await _dbContext.Subscriptions() + .FirstOrDefaultAsync(s => s.Id == xchange.SubscriptionId); + if (request.Reset) { - var subscription = await _dbContext.FindAsync(xchange.SubscriptionId); if (subscription == null) throw new SWValidationException("SUBSCRIPTION_NOT_FOUND", "Cant reset properties, subscription doesnt exist anymore"); @@ -40,7 +42,8 @@ public async Task Handle(XchangeBulkRetry request) } else { - await _xchangeService.CreateXchange(xchange, xchangeFile); + + await _xchangeService.CreateXchange(xchange, xchangeFile, subscription.WorkGroup); } } diff --git a/SW.Bitween.Api/Resources/Xchanges/Create.cs b/SW.Bitween.Api/Resources/Xchanges/Create.cs index b8b3dfe6..e54a9121 100644 --- a/SW.Bitween.Api/Resources/Xchanges/Create.cs +++ b/SW.Bitween.Api/Resources/Xchanges/Create.cs @@ -27,7 +27,7 @@ public async Task Handle(CreateXchange request) { var document = await _dbc.Set().FirstOrDefaultAsync(d => d.Id == request.DocumentId); if (document == null) throw new SWValidationException("DOCUMENT_NOT_FOUND", "Document was not found"); - await _xchangeService.CreateXchange(document, xchangeFile); + await _xchangeService.CreateXchange(document,WorkGroup.None, xchangeFile); } else if (request.Option == CreateXchangeOption.SubscriberId) { diff --git a/SW.Bitween.Api/Resources/Xchanges/Retry.cs b/SW.Bitween.Api/Resources/Xchanges/Retry.cs index 88248464..a7f14abb 100644 --- a/SW.Bitween.Api/Resources/Xchanges/Retry.cs +++ b/SW.Bitween.Api/Resources/Xchanges/Retry.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; using SW.PrimitiveTypes; using SW.Bitween.Model; using SW.Bitween.Domain; @@ -22,11 +23,10 @@ public async Task Handle(string key, XchangeRetry xchangeRetry) var xchange = await dbContext.FindAsync(key); var inputFileData = await xchangeService.GetFile(xchange.Id, XchangeFileType.Input); var xchangeFile = new XchangeFile(inputFileData, xchange.InputName); - - + var subscription = await dbContext.Subscriptions().FirstOrDefaultAsync(s => s.Id == xchange.SubscriptionId); if (xchangeRetry.Reset) { - var subscription = await dbContext.FindAsync(xchange.SubscriptionId); + if (subscription == null) throw new SWValidationException("SUBSCRIPTION_NOT_FOUND", "Cant reset properties, subscription doesnt exist anymore"); @@ -34,7 +34,7 @@ public async Task Handle(string key, XchangeRetry xchangeRetry) } else { - await xchangeService.CreateXchange(xchange, xchangeFile); + await xchangeService.CreateXchange(xchange,xchangeFile,subscription?.WorkGroup ); } diff --git a/SW.Bitween.Api/Resources/Xchanges/Update.cs b/SW.Bitween.Api/Resources/Xchanges/Update.cs index 516a6433..daa4aa85 100644 --- a/SW.Bitween.Api/Resources/Xchanges/Update.cs +++ b/SW.Bitween.Api/Resources/Xchanges/Update.cs @@ -62,7 +62,7 @@ public async Task Handle(string documentIdOrName, dynamic request) if (par.Partner.Id == Partner.SystemId && sub is null) { - await _xchangeService.SubmitFilterXchange(document.Id, new XchangeFile(request.ToString())); + await _xchangeService.SubmitFilterXchange(document.Id,WorkGroup.None, new XchangeFile(request.ToString())); return null; } diff --git a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs index 7f6efc07..12047859 100644 --- a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs +++ b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs @@ -34,23 +34,25 @@ private async Task Load() using var scope = _ssf.CreateScope(); var repo = scope.ServiceProvider.GetRequiredService(); _logger.LogInformation("Loading documents and subscriptions to cache"); - var cachedSubscriptions = await repo.Set() + var cachedSubscriptions = await repo.Set().Include(s=>s.WorkGroup) .AsNoTracking().Where(i => !i.Inactive).ToArrayAsync(); var cachedDocuments = await repo.Set().AsNoTracking().ToArrayAsync(); var cachedNotifiers = await repo.Set().Where(i => !i.Inactive).AsNoTracking().ToArrayAsync(); - + var cachedWorkGroups = await repo.Set().AsNoTracking().ToArrayAsync(); var span = TimeSpan.FromMinutes(10); - _cache.Set("documents", cachedDocuments, span); - _cache.Set("subscriptions", cachedSubscriptions, span); - _cache.Set("notifiers", cachedNotifiers, span); + _cache.Set(nameof(Document), cachedDocuments, span); + + _cache.Set(nameof(Subscription), cachedSubscriptions, span); + _cache.Set(nameof(Notifier), cachedNotifiers, span); + _cache.Set(nameof(WorkGroup), cachedWorkGroups, span); } public async Task ListSubscriptionsByDocumentAsync(int documentId) { - if (!_cache.TryGetValue("subscriptions", out Subscription[] cachedSubscriptions)) + if (!_cache.TryGetValue(nameof(Subscription), out Subscription[] cachedSubscriptions)) { await Load(); - return _cache.Get("subscriptions").Where(sub => sub.DocumentId == documentId).ToArray(); + return _cache.Get(nameof(Subscription)).Where(sub => sub.DocumentId == documentId).ToArray(); } return cachedSubscriptions.Where(sub => sub.DocumentId == documentId).ToArray(); @@ -58,10 +60,11 @@ public async Task ListSubscriptionsByDocumentAsync(int documentI public async Task ListNotifiersAsync() { - if (!_cache.TryGetValue("notifiers", out Notifier[] cachedNotifiers)) + if (!_cache.TryGetValue(nameof(Notifier), out Notifier[] cachedNotifiers)) { await Load(); - return _cache.Get("notifiers"); + return _cache.Get(nameof(Notifier)); + } return cachedNotifiers; @@ -69,10 +72,10 @@ public async Task ListNotifiersAsync() public async Task SubscriptionByIdAsync(int subscriptionId) { - if (!_cache.TryGetValue("subscriptions", out Subscription[] cachedSubscriptions)) + if (!_cache.TryGetValue(nameof(Subscription), out Subscription[] cachedSubscriptions)) { await Load(); - return _cache.Get("subscriptions").FirstOrDefault(sub => sub.Id == subscriptionId); + return _cache.Get(nameof(Subscription)).FirstOrDefault(sub => sub.Id == subscriptionId); } return cachedSubscriptions.FirstOrDefault(sub => sub.Id == subscriptionId); @@ -80,10 +83,10 @@ public async Task SubscriptionByIdAsync(int subscriptionId) public async Task DocumentByIdAsync(int documentId) { - if (!_cache.TryGetValue("documents", out Document[] cachedDocuments)) + if (!_cache.TryGetValue(nameof(Document), out Document[] cachedDocuments)) { await Load(); - return _cache.Get("documents").FirstOrDefault(d => d.Id == documentId); + return _cache.Get(nameof(Document)).FirstOrDefault(d => d.Id == documentId); } return cachedDocuments.FirstOrDefault(d => d.Id == documentId); @@ -91,10 +94,10 @@ public async Task DocumentByIdAsync(int documentId) public async Task DocumentByNameAsync(string documentName) { - if (!_cache.TryGetValue("documents", out Document[] cachedDocuments)) + if (!_cache.TryGetValue(nameof(Document), out Document[] cachedDocuments)) { await Load(); - return _cache.Get("documents").FirstOrDefault(d => + return _cache.Get(nameof(Document)).FirstOrDefault(d => string.Equals(d.Name, documentName, StringComparison.CurrentCultureIgnoreCase)); } @@ -109,10 +112,33 @@ public void BroadcastRevoke() broadcast.Broadcast(new RevokeCacheMessage()); } + public async Task ListWorkGroupsAsync() + { + if (!_cache.TryGetValue(nameof(WorkGroup), out WorkGroup[] cachedWorkGroups)) + { + await Load(); + return _cache.Get(nameof(WorkGroup)); + } + + return cachedWorkGroups; + } + + public async Task WorkGroupByIdAsync(int workGroupId) + { + if (!_cache.TryGetValue(nameof(WorkGroup), out WorkGroup[] cachedWorkGroups)) + { + await Load(); + return _cache.Get(nameof(WorkGroup)).FirstOrDefault(wg => wg.Id == workGroupId); + } + + return cachedWorkGroups.FirstOrDefault(wg => wg.Id == workGroupId); + } + public void Revoke() { - _cache.Remove("subscriptions"); - _cache.Remove("notifiers"); - _cache.Remove("documents"); + _cache.Remove(nameof(Subscription)); + _cache.Remove(nameof(Notifier)); + _cache.Remove(nameof(Document)); + _cache.Remove(nameof(WorkGroup)); } } \ No newline at end of file diff --git a/SW.Bitween.Api/Services/XchangeService.cs b/SW.Bitween.Api/Services/XchangeService.cs index 1d859c41..1c5b5082 100644 --- a/SW.Bitween.Api/Services/XchangeService.cs +++ b/SW.Bitween.Api/Services/XchangeService.cs @@ -19,7 +19,8 @@ public class XchangeService : IConsume, IConsume, IConsume, - IConsume + IConsume, + IConsume { private readonly BitweenOptions _BitweenSettings; @@ -64,21 +65,20 @@ public async Task SubmitFilterXchange(int documentId, XchangeFile file, string[] if (document?.DisregardsUnfilteredMessages ?? false) { - xchange = new Xchange(documentId, file, references, SubscriptionType.Internal, correlationId); - var result = await _filterService.Filter(xchange.DocumentId, file); - await CreateXchangesForHits(xchange, result, file); + var result = await _filterService.Filter(documentId, file); + await CreateXchangesForHits(correlationId, result, file); } else { - xchange = await CreateXchange(document, file, references, correlationId); + await CreateXchange(document, file, references, correlationId); } await _dbContext.SaveChangesAsync(); } - public async Task CreateXchange(Xchange xchange, XchangeFile file) + public async Task CreateXchange(Xchange xchange, XchangeFile file, WorkGroup workGroup) { - var newXchange = new Xchange(xchange, file); + var newXchange = new Xchange(xchange, file,workGroup); await AddFile(newXchange.Id, XchangeFileType.Input, file); _dbContext.Add(newXchange); } @@ -91,10 +91,10 @@ public async Task CreateXchange(Subscription subscription, Xchange xchange, Xcha _dbContext.Add(newXchange); } - public async Task CreateXchange(Document document, XchangeFile file, string[] references = null, + public async Task CreateXchange(Document document, WorkGroup workGroup, XchangeFile file, string[] references = null, string correlationId = null) { - var xchange = new Xchange(document.Id, file, references, SubscriptionType.Internal, correlationId); + var xchange = new Xchange(document.Id,workGroup, file, references, SubscriptionType.Internal, correlationId); await AddFile(xchange.Id, XchangeFileType.Input, file); _dbContext.Add(xchange); return xchange; @@ -265,7 +265,7 @@ private async Task Process(XchangeCreatedEvent message) } - async Task CreateXchangesForHits(Xchange xchange, FilterResult result, XchangeFile inputFile) + async Task CreateXchangesForHits(string correlationId, FilterResult result, XchangeFile inputFile) { foreach (var subscriptionId in result.Hits) { @@ -276,7 +276,7 @@ async Task CreateXchangesForHits(Xchange xchange, FilterResult result, XchangeFi } else { - await CreateXchange(subscription, inputFile, null, xchange.CorrelationId); + await CreateXchange(subscription, inputFile, null, correlationId); } } } @@ -385,5 +385,20 @@ public async Task Process(SubscriptionUnpausedEvent message) await _dbContext.SaveChangesAsync(); } + + public async Task> GetMessageTypeNames() + { + var workgroups = (await _BitweenCache.ListWorkGroupsAsync()).ToList(); + workgroups.Add(WorkGroup.None); + var list = workgroups.Select(w => $"{w.Id}{w.BusMessageName}").ToList(); + return list; + } + + + public Task Process(string messageTypeName, string message) + { + var eventMessage = JsonConvert.DeserializeObject(message); + return Process(eventMessage); + } } } \ No newline at end of file From 74a24bf470356ca5314988b1918065d685d83cb0 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Wed, 14 Jan 2026 12:22:19 +0300 Subject: [PATCH 2/8] Add support for legacy event message consumption and update package references --- .../Domain/Subscription/WorkGroup.cs | 6 + SW.Bitween.Api/Resources/Xchanges/Update.cs | 2 +- SW.Bitween.Api/SW.Bitween.Api.csproj | 4 +- SW.Bitween.Api/Services/BitweenOptions.cs | 1 + SW.Bitween.Api/Services/XchangeService.cs | 629 +++++++++--------- SW.Bitween.Web/SW.Bitween.Web.csproj | 2 +- 6 files changed, 335 insertions(+), 309 deletions(-) diff --git a/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs b/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs index 9b64a525..3781fc64 100644 --- a/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs +++ b/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs @@ -1,10 +1,16 @@ +using SW.Bus.RabbitMqExtensions; using SW.PrimitiveTypes; namespace SW.Bitween.Domain; +public class WorkGroupOptions +{ + public ConsumerOptions RabbitMqOptions { get; set; } +} public class WorkGroup : BaseEntity { public string Name { get; set; } public string BusMessageName { get; set; } public static WorkGroup None => new() { BusMessageName = "Ungrouped"}; + public WorkGroupOptions Options { get; set; } } \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/Xchanges/Update.cs b/SW.Bitween.Api/Resources/Xchanges/Update.cs index daa4aa85..bb395ec1 100644 --- a/SW.Bitween.Api/Resources/Xchanges/Update.cs +++ b/SW.Bitween.Api/Resources/Xchanges/Update.cs @@ -62,7 +62,7 @@ public async Task Handle(string documentIdOrName, dynamic request) if (par.Partner.Id == Partner.SystemId && sub is null) { - await _xchangeService.SubmitFilterXchange(document.Id,WorkGroup.None, new XchangeFile(request.ToString())); + await _xchangeService.SubmitFilterXchange(document.Id,new XchangeFile(request.ToString())); return null; } diff --git a/SW.Bitween.Api/SW.Bitween.Api.csproj b/SW.Bitween.Api/SW.Bitween.Api.csproj index 0b3ba196..09621ebe 100644 --- a/SW.Bitween.Api/SW.Bitween.Api.csproj +++ b/SW.Bitween.Api/SW.Bitween.Api.csproj @@ -20,8 +20,8 @@ - - + + diff --git a/SW.Bitween.Api/Services/BitweenOptions.cs b/SW.Bitween.Api/Services/BitweenOptions.cs index 05eacbc0..2f9b545e 100644 --- a/SW.Bitween.Api/Services/BitweenOptions.cs +++ b/SW.Bitween.Api/Services/BitweenOptions.cs @@ -42,5 +42,6 @@ public BitweenOptions() public string MsalTenantId { get; set; } public int JwtExpiryMinutes { get; set; } + public bool ConsumeLegacyEventMessages { get; set; } } } \ No newline at end of file diff --git a/SW.Bitween.Api/Services/XchangeService.cs b/SW.Bitween.Api/Services/XchangeService.cs index 1c5b5082..02bb9a5a 100644 --- a/SW.Bitween.Api/Services/XchangeService.cs +++ b/SW.Bitween.Api/Services/XchangeService.cs @@ -10,395 +10,414 @@ using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; +using SW.Bus.RabbitMqExtensions; + +namespace SW.Bitween; + +public class XchangeService : + IConsume, + IConsume, + IConsume, + IConsume, + IConsume, + IConsume, + IConsumeExtended -namespace SW.Bitween { - public class XchangeService : - IConsume, - IConsume, - IConsume, - IConsume, - IConsume, - IConsume, - IConsume + private readonly BitweenOptions _BitweenSettings; + private readonly BitweenDbContext _dbContext; + private readonly FilterService _filterService; + private readonly ICloudFilesService _cloudFiles; + private readonly IServiceProvider _serviceProvider; + private readonly IPublish _publish; + private readonly ILogger _logger; + private readonly IInfolinkCache _BitweenCache; + + public XchangeService(BitweenOptions BitweenSettings, BitweenDbContext dbContext, + FilterService filterService, + ICloudFilesService cloudFiles, IServiceProvider serviceProvider, + IPublish publish, ILogger logger, IInfolinkCache BitweenCache) + { + _BitweenSettings = BitweenSettings; + _dbContext = dbContext; + _filterService = filterService; + _cloudFiles = cloudFiles; + _serviceProvider = serviceProvider; + _publish = publish; + _logger = logger; + _BitweenCache = BitweenCache; + } + public async Task SubmitSubscriptionXchange(int subscriptionId, XchangeFile file, + string[] references = null) { - private readonly BitweenOptions _BitweenSettings; - private readonly BitweenDbContext _dbContext; - private readonly FilterService _filterService; - private readonly ICloudFilesService _cloudFiles; - private readonly IServiceProvider _serviceProvider; - private readonly IPublish _publish; - private readonly ILogger _logger; - private readonly IInfolinkCache _BitweenCache; - - public XchangeService(BitweenOptions BitweenSettings, BitweenDbContext dbContext, - FilterService filterService, - ICloudFilesService cloudFiles, IServiceProvider serviceProvider, - IPublish publish, ILogger logger, IInfolinkCache BitweenCache) - { - _BitweenSettings = BitweenSettings; - _dbContext = dbContext; - _filterService = filterService; - _cloudFiles = cloudFiles; - _serviceProvider = serviceProvider; - _publish = publish; - _logger = logger; - _BitweenCache = BitweenCache; - } + var subscription = await _BitweenCache.SubscriptionByIdAsync(subscriptionId); - public async Task SubmitSubscriptionXchange(int subscriptionId, XchangeFile file, - string[] references = null) - { - var subscription = await _BitweenCache.SubscriptionByIdAsync(subscriptionId); + var xchange = await CreateXchange(subscription, file, references, Guid.NewGuid().ToString("N")); + await _dbContext.SaveChangesAsync(); + return xchange.Id; + } - var xchange = await CreateXchange(subscription, file, references, Guid.NewGuid().ToString("N")); - await _dbContext.SaveChangesAsync(); - return xchange.Id; - } + public async Task SubmitFilterXchange(int documentId, XchangeFile file, string[] references = null, + string correlationId = null) + { + var document = await _BitweenCache.DocumentByIdAsync(documentId); + Xchange xchange; - public async Task SubmitFilterXchange(int documentId, XchangeFile file, string[] references = null, - string correlationId = null) + if (document?.DisregardsUnfilteredMessages ?? false) { - var document = await _BitweenCache.DocumentByIdAsync(documentId); - Xchange xchange; - - if (document?.DisregardsUnfilteredMessages ?? false) - { - var result = await _filterService.Filter(documentId, file); - await CreateXchangesForHits(correlationId, result, file); - } - else - { - await CreateXchange(document, file, references, correlationId); - } - - await _dbContext.SaveChangesAsync(); + var result = await _filterService.Filter(documentId, file); + await CreateXchangesForHits(correlationId, result, file); } - - public async Task CreateXchange(Xchange xchange, XchangeFile file, WorkGroup workGroup) + else { - var newXchange = new Xchange(xchange, file,workGroup); - await AddFile(newXchange.Id, XchangeFileType.Input, file); - _dbContext.Add(newXchange); + await CreateXchange(document, file, references, correlationId); } - public async Task CreateXchange(Subscription subscription, Xchange xchange, XchangeFile file, - string[] references = null) - { - var newXchange = new Xchange(subscription, xchange, file); - await AddFile(newXchange.Id, XchangeFileType.Input, file); - _dbContext.Add(newXchange); - } + await _dbContext.SaveChangesAsync(); + } - public async Task CreateXchange(Document document, WorkGroup workGroup, XchangeFile file, string[] references = null, - string correlationId = null) - { - var xchange = new Xchange(document.Id,workGroup, file, references, SubscriptionType.Internal, correlationId); - await AddFile(xchange.Id, XchangeFileType.Input, file); - _dbContext.Add(xchange); - return xchange; - } + public async Task CreateXchange(Xchange xchange, XchangeFile file, WorkGroup workGroup) + { + var newXchange = new Xchange(xchange, file,workGroup); + await AddFile(newXchange.Id, XchangeFileType.Input, file); + _dbContext.Add(newXchange); + } - public async Task CreateXchange(Subscription subscription, XchangeFile file, - string[] references = null, string correlationId = null) - { - var xchange = new Xchange(subscription, file, references, correlationId); - await AddFile(xchange.Id, XchangeFileType.Input, file); - _dbContext.Add(xchange); - return xchange; - } + public async Task CreateXchange(Subscription subscription, Xchange xchange, XchangeFile file, + string[] references = null) + { + var newXchange = new Xchange(subscription, xchange, file); + await AddFile(newXchange.Id, XchangeFileType.Input, file); + _dbContext.Add(newXchange); + } - private Task CreateOnHoldXchange(Subscription subscription, XchangeFile file, string[] references = null) - { - var xchange = new OnHoldXchange(subscription, file.Data, file.Filename, file.BadData, references); - _dbContext.Add(xchange); - return Task.CompletedTask; - } + public async Task CreateXchange(Document document, WorkGroup workGroup, XchangeFile file, string[] references = null, + string correlationId = null) + { + var xchange = new Xchange(document.Id,workGroup, file, references, SubscriptionType.Internal, correlationId); + await AddFile(xchange.Id, XchangeFileType.Input, file); + _dbContext.Add(xchange); + return xchange; + } + public async Task CreateXchange(Subscription subscription, XchangeFile file, + string[] references = null, string correlationId = null) + { + var xchange = new Xchange(subscription, file, references, correlationId); + await AddFile(xchange.Id, XchangeFileType.Input, file); + _dbContext.Add(xchange); + return xchange; + } - private async Task RunMapper(Xchange xchange, XchangeFile xchangeFile) - { - if (xchange.MapperId == null) return xchangeFile; + private Task CreateOnHoldXchange(Subscription subscription, XchangeFile file, string[] references = null) + { + var xchange = new OnHoldXchange(subscription, file.Data, file.Filename, file.BadData, references); + _dbContext.Add(xchange); + return Task.CompletedTask; + } - var serverless = _serviceProvider.GetRequiredService(); - var mapperProperties = xchange.MapperProperties.ToDictionary(); - mapperProperties["xchangeid"] = xchange.Id; + private async Task RunMapper(Xchange xchange, XchangeFile xchangeFile) + { + if (xchange.MapperId == null) return xchangeFile; - await serverless.StartAsync(xchange.MapperId, xchange.CorrelationId ?? xchange.Id, mapperProperties); - xchangeFile = await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), xchangeFile); - if (xchangeFile is null) - throw new BitweenException( - $"Unexpected null return value after running mapping for exchange id: {xchange.Id}, adapter id: {xchange.MapperId}"); - else - await AddFile(xchange.Id, XchangeFileType.Output, xchangeFile); - return xchangeFile; - } + var serverless = _serviceProvider.GetRequiredService(); - public async Task RunValidator(string validatorId, IDictionary properties, - XchangeFile xchangeFile) - { - if (validatorId == null) return; - - var serverless = _serviceProvider.GetRequiredService(); - await serverless.StartAsync(validatorId, null, properties); - var result = - await serverless.InvokeAsync(nameof(IInfolinkValidator.Validate), xchangeFile); - if (!result.Success) - throw new SWValidationException(result.Validations); - } + var mapperProperties = xchange.MapperProperties.ToDictionary(); + mapperProperties["xchangeid"] = xchange.Id; - private async Task RunHandler(Xchange xchange, XchangeFile xchangeFile) - { - if (xchange.HandlerId == null) return null; + await serverless.StartAsync(xchange.MapperId, xchange.CorrelationId ?? xchange.Id, mapperProperties); + xchangeFile = await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), xchangeFile); + if (xchangeFile is null) + throw new BitweenException( + $"Unexpected null return value after running mapping for exchange id: {xchange.Id}, adapter id: {xchange.MapperId}"); + else + await AddFile(xchange.Id, XchangeFileType.Output, xchangeFile); + return xchangeFile; + } - var serverless = _serviceProvider.GetRequiredService(); + public async Task RunValidator(string validatorId, IDictionary properties, + XchangeFile xchangeFile) + { + if (validatorId == null) return; + + var serverless = _serviceProvider.GetRequiredService(); + await serverless.StartAsync(validatorId, null, properties); + var result = + await serverless.InvokeAsync(nameof(IInfolinkValidator.Validate), xchangeFile); + if (!result.Success) + throw new SWValidationException(result.Validations); + } - var handlerProperties = xchange.HandlerProperties.ToDictionary(); - handlerProperties["xchangeid"] = xchange.Id; + private async Task RunHandler(Xchange xchange, XchangeFile xchangeFile) + { + if (xchange.HandlerId == null) return null; - await serverless.StartAsync(xchange.HandlerId, xchange.CorrelationId ?? xchange.Id, handlerProperties); - xchangeFile = await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), xchangeFile); - if (xchangeFile != null) - await AddFile(xchange.Id, XchangeFileType.Response, xchangeFile); - return xchangeFile; - } + var serverless = _serviceProvider.GetRequiredService(); - private async Task AddFile(string xchangeId, XchangeFileType type, XchangeFile file) - { - await _cloudFiles.WriteTextAsync(file.Data, new WriteFileSettings - { - Public = !_BitweenSettings.AreXChangeFilesPrivate, - Key = GetFileKey(xchangeId, type) - }); - } + var handlerProperties = xchange.HandlerProperties.ToDictionary(); + handlerProperties["xchangeid"] = xchange.Id; - public string GetFileUrl(string xchangeId, XchangeFileType type) - { - return _cloudFiles.GetUrl(GetFileKey(xchangeId, type)); - } + await serverless.StartAsync(xchange.HandlerId, xchange.CorrelationId ?? xchange.Id, handlerProperties); + xchangeFile = await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), xchangeFile); + if (xchangeFile != null) + await AddFile(xchange.Id, XchangeFileType.Response, xchangeFile); + return xchangeFile; + } - public string GetFileUrl(string xchangeId, int? fileSize, XchangeFileType type) + private async Task AddFile(string xchangeId, XchangeFileType type, XchangeFile file) + { + await _cloudFiles.WriteTextAsync(file.Data, new WriteFileSettings { - return fileSize is null or 0 ? null : _cloudFiles.GetUrl(GetFileKey(xchangeId, type)); - } + Public = !_BitweenSettings.AreXChangeFilesPrivate, + Key = GetFileKey(xchangeId, type) + }); + } - public string GetFileKey(string xchangeId, int? fileSize, XchangeFileType type) - { - if (fileSize is null or 0) - return null; - var key = $"{_BitweenSettings.DocumentPrefix}/{xchangeId}/{type.ToString().ToLower()}"; - _logger.LogInformation($"the file key is:'{key}'"); - return key; - } + public string GetFileUrl(string xchangeId, XchangeFileType type) + { + return _cloudFiles.GetUrl(GetFileKey(xchangeId, type)); + } - private string GetFileKey(string xchangeId, XchangeFileType type) - { - var key = $"{_BitweenSettings.DocumentPrefix}/{xchangeId}/{type.ToString().ToLower()}"; - _logger.LogInformation($"the file key is:'{key}'"); - return key; - } + public string GetFileUrl(string xchangeId, int? fileSize, XchangeFileType type) + { + return fileSize is null or 0 ? null : _cloudFiles.GetUrl(GetFileKey(xchangeId, type)); + } - public async Task GetFile(string xchangeId, XchangeFileType type) - { - await using var cloudStream = await _cloudFiles.OpenReadAsync(GetFileKey(xchangeId, type)); - using var reader = new StreamReader(cloudStream); - return await reader.ReadToEndAsync(); - } + public string GetFileKey(string xchangeId, int? fileSize, XchangeFileType type) + { + if (fileSize is null or 0) + return null; + var key = $"{_BitweenSettings.DocumentPrefix}/{xchangeId}/{type.ToString().ToLower()}"; + _logger.LogInformation($"the file key is:'{key}'"); + return key; + } - private async Task Process(XchangeCreatedEvent message) - { - Xchange responseXchange = null; - XchangeFile outputFile = null; - XchangeFile responseFile = null; + private string GetFileKey(string xchangeId, XchangeFileType type) + { + var key = $"{_BitweenSettings.DocumentPrefix}/{xchangeId}/{type.ToString().ToLower()}"; + _logger.LogInformation($"the file key is:'{key}'"); + return key; + } - var xchange = await _dbContext.FindAsync(message.Id); + public async Task GetFile(string xchangeId, XchangeFileType type) + { + await using var cloudStream = await _cloudFiles.OpenReadAsync(GetFileKey(xchangeId, type)); + using var reader = new StreamReader(cloudStream); + return await reader.ReadToEndAsync(); + } - if (xchange == null) throw new BitweenException($"Xchange '{message.Id}' not found."); + private async Task Process(XchangeCreatedEvent message) + { + Xchange responseXchange = null; + XchangeFile outputFile = null; + XchangeFile responseFile = null; - try - { - var inputFile = new XchangeFile(await GetFile(xchange.Id, XchangeFileType.Input), xchange.InputName); - var result = await _filterService.Filter(xchange.DocumentId, inputFile); + var xchange = await _dbContext.FindAsync(message.Id); - _dbContext.Add(new XchangePromotedProperties(xchange.Id, result)); + if (xchange == null) throw new BitweenException($"Xchange '{message.Id}' not found."); - if (xchange.SubscriptionId != null) + try + { + var inputFile = new XchangeFile(await GetFile(xchange.Id, XchangeFileType.Input), xchange.InputName); + var result = await _filterService.Filter(xchange.DocumentId, inputFile); + + _dbContext.Add(new XchangePromotedProperties(xchange.Id, result)); + + if (xchange.SubscriptionId != null) + { + if (xchange.MapperId == null) + responseFile = await RunHandler(xchange, inputFile); + else { - if (xchange.MapperId == null) - responseFile = await RunHandler(xchange, inputFile); - else - { - outputFile = await RunMapper(xchange, inputFile); - responseFile = await RunHandler(xchange, outputFile); - } - - if (xchange.ResponseSubscriptionId != null && responseFile != null) - { - var subscription = - await _BitweenCache.SubscriptionByIdAsync(xchange.ResponseSubscriptionId.Value); - - responseXchange = await CreateXchange(subscription, responseFile, null, xchange.CorrelationId); - } - - if (!string.IsNullOrWhiteSpace(xchange.ResponseMessageTypeName) && responseFile != null && - !responseFile.BadData) - { - await _publish.Publish(xchange.ResponseMessageTypeName, responseFile.Data); - } + outputFile = await RunMapper(xchange, inputFile); + responseFile = await RunHandler(xchange, outputFile); } - else if (xchange.SubscriptionId == null) + + if (xchange.ResponseSubscriptionId != null && responseFile != null) { - await CreateXchangesForHits(xchange, result, inputFile); + var subscription = + await _BitweenCache.SubscriptionByIdAsync(xchange.ResponseSubscriptionId.Value); + + responseXchange = await CreateXchange(subscription, responseFile, null, xchange.CorrelationId); } - _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id)); - await _dbContext.SaveChangesAsync(); + if (!string.IsNullOrWhiteSpace(xchange.ResponseMessageTypeName) && responseFile != null && + !responseFile.BadData) + { + await _publish.Publish(xchange.ResponseMessageTypeName, responseFile.Data); + } } - catch (Exception ex) + else if (xchange.SubscriptionId == null) { - _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id, - ex.ToString())); - await _dbContext.SaveChangesAsync(); + await CreateXchangesForHits(xchange, result, inputFile); } + + _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id)); + await _dbContext.SaveChangesAsync(); + } + catch (Exception ex) + { + _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id, + ex.ToString())); + await _dbContext.SaveChangesAsync(); } + } - async Task CreateXchangesForHits(string correlationId, FilterResult result, XchangeFile inputFile) + async Task CreateXchangesForHits(string correlationId, FilterResult result, XchangeFile inputFile) + { + foreach (var subscriptionId in result.Hits) { - foreach (var subscriptionId in result.Hits) + var subscription = await _BitweenCache.SubscriptionByIdAsync(subscriptionId); + if (subscription.PausedOn != null) { - var subscription = await _BitweenCache.SubscriptionByIdAsync(subscriptionId); - if (subscription.PausedOn != null) - { - await CreateOnHoldXchange(subscription, inputFile); - } - else - { - await CreateXchange(subscription, inputFile, null, correlationId); - } + await CreateOnHoldXchange(subscription, inputFile); + } + else + { + await CreateXchange(subscription, inputFile, null, correlationId); } } + } - Task IConsume.Process(ApiXchangeCreatedEvent message) => Process(message); + Task IConsume.Process(ApiXchangeCreatedEvent message) => Process(message); - Task IConsume.Process(AggregateXchangeCreatedEvent message) => Process(message); + Task IConsume.Process(AggregateXchangeCreatedEvent message) => Process(message); - Task IConsume.Process(InternalXchangeCreatedEvent message) => Process(message); + Task IConsume.Process(InternalXchangeCreatedEvent message) => Process(message); - Task IConsume.Process(ReceivingXchangeCreatedEvent message) => Process(message); + Task IConsume.Process(ReceivingXchangeCreatedEvent message) => Process(message); - public async Task Process(XchangeResultCreatedEvent message) - { - var notifiers = await _BitweenCache.ListNotifiersAsync(); + public async Task Process(XchangeResultCreatedEvent message) + { + var notifiers = await _BitweenCache.ListNotifiersAsync(); - var xchangeResult = await _dbContext.FindAsync(message.Id); + var xchangeResult = await _dbContext.FindAsync(message.Id); - var xchange = await _dbContext.FindAsync(message.Id); + var xchange = await _dbContext.FindAsync(message.Id); - foreach (var notifier in notifiers) - { - if (notifier.Inactive || notifier.RunOnSubscriptions is null) continue; + foreach (var notifier in notifiers) + { + if (notifier.Inactive || notifier.RunOnSubscriptions is null) continue; - //review - if (notifier.RunOnSubscriptions.All(i => i != xchange!.SubscriptionId)) - { - continue; - } + //review + if (notifier.RunOnSubscriptions.All(i => i != xchange!.SubscriptionId)) + { + continue; + } - switch (message.Success) - { - case true when !message.ResponseBad && notifier.RunOnSuccessfulResult: - case true when message.ResponseBad && notifier.RunOnBadResult: - case false when notifier.RunOnFailedResult: - await NotifyResult(notifier, xchangeResult, xchange?.CorrelationId ?? xchange?.Id); - break; - } + switch (message.Success) + { + case true when !message.ResponseBad && notifier.RunOnSuccessfulResult: + case true when message.ResponseBad && notifier.RunOnBadResult: + case false when notifier.RunOnFailedResult: + await NotifyResult(notifier, xchangeResult, xchange?.CorrelationId ?? xchange?.Id); + break; } } + } - private async Task NotifyResult(Notifier notifier, XchangeResult xchangeResult, string correlationId) - { - if (xchangeResult == null) throw new BitweenException($"Xchange Result '{xchangeResult.Id}' not found."); + private async Task NotifyResult(Notifier notifier, XchangeResult xchangeResult, string correlationId) + { + if (xchangeResult == null) throw new BitweenException($"Xchange Result '{xchangeResult.Id}' not found."); - if (notifier?.HandlerId == null) return; + if (notifier?.HandlerId == null) return; - var xchange = await _dbContext.FindAsync(xchangeResult.Id); - var subscription = await _BitweenCache.SubscriptionByIdAsync(xchange!.SubscriptionId!.Value); - var document = await _BitweenCache.DocumentByIdAsync(xchange.DocumentId); + var xchange = await _dbContext.FindAsync(xchangeResult.Id); + var subscription = await _BitweenCache.SubscriptionByIdAsync(xchange!.SubscriptionId!.Value); + var document = await _BitweenCache.DocumentByIdAsync(xchange.DocumentId); - var notificationData = new XchangeResultNotification - { - Id = xchangeResult.Id, - Exception = xchangeResult.Exception, - Success = xchangeResult.Success, - FinishedOn = xchangeResult.FinishedOn, - OutputBad = xchangeResult.OutputBad, - ResponseBad = xchangeResult.ResponseBad, - StartedOn = xchange.StartedOn, - SubscriptionName = subscription.Name, - SubscriptionId = subscription.Id, - DocumentName = document.Name, - DocumentId = document.Id, - CorrelationId = xchange.CorrelationId - }; - - var serverless = _serviceProvider.GetRequiredService(); - - var handlerProperties = notifier.HandlerProperties.ToDictionary(); - handlerProperties["xchangeid"] = xchangeResult.Id; - - try - { - await serverless.StartAsync(notifier.HandlerId, correlationId, handlerProperties); - await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), - new XchangeFile(JsonConvert.SerializeObject(notificationData), xchangeResult.Id)); - - _dbContext.Add(new XchangeNotification(xchangeResult.Id, notifier.Id, notifier.Name)); - } - catch (Exception ex) - { - _dbContext.Add(new XchangeNotification(xchangeResult.Id, notifier.Id, notifier.Name, ex.ToString())); - } + var notificationData = new XchangeResultNotification + { + Id = xchangeResult.Id, + Exception = xchangeResult.Exception, + Success = xchangeResult.Success, + FinishedOn = xchangeResult.FinishedOn, + OutputBad = xchangeResult.OutputBad, + ResponseBad = xchangeResult.ResponseBad, + StartedOn = xchange.StartedOn, + SubscriptionName = subscription.Name, + SubscriptionId = subscription.Id, + DocumentName = document.Name, + DocumentId = document.Id, + CorrelationId = xchange.CorrelationId + }; + + var serverless = _serviceProvider.GetRequiredService(); + + var handlerProperties = notifier.HandlerProperties.ToDictionary(); + handlerProperties["xchangeid"] = xchangeResult.Id; + + try + { + await serverless.StartAsync(notifier.HandlerId, correlationId, handlerProperties); + await serverless.InvokeAsync(nameof(IInfolinkHandler.Handle), + new XchangeFile(JsonConvert.SerializeObject(notificationData), xchangeResult.Id)); - await _dbContext.SaveChangesAsync(); + _dbContext.Add(new XchangeNotification(xchangeResult.Id, notifier.Id, notifier.Name)); } - - public async Task Process(SubscriptionUnpausedEvent message) + catch (Exception ex) { - var subscription = await _BitweenCache.SubscriptionByIdAsync(message.Id); + _dbContext.Add(new XchangeNotification(xchangeResult.Id, notifier.Id, notifier.Name, ex.ToString())); + } - if (subscription == null || subscription.Inactive || subscription.PausedOn != null) return; + await _dbContext.SaveChangesAsync(); + } - var xchangesDetails = await _dbContext.Set().Where(x => x.SubscriptionId == subscription.Id) - .ToListAsync(); + public async Task Process(SubscriptionUnpausedEvent message) + { + var subscription = await _BitweenCache.SubscriptionByIdAsync(message.Id); - foreach (var xchangeDetails in xchangesDetails) - { - var file = new XchangeFile(xchangeDetails.Data, xchangeDetails.FileName, xchangeDetails.BadData); - await CreateXchange(subscription, file, xchangeDetails.References); - _dbContext.Remove(xchangeDetails); - } + if (subscription == null || subscription.Inactive || subscription.PausedOn != null) return; - await _dbContext.SaveChangesAsync(); - } + var xchangesDetails = await _dbContext.Set().Where(x => x.SubscriptionId == subscription.Id) + .ToListAsync(); - public async Task> GetMessageTypeNames() + foreach (var xchangeDetails in xchangesDetails) { - var workgroups = (await _BitweenCache.ListWorkGroupsAsync()).ToList(); - workgroups.Add(WorkGroup.None); - var list = workgroups.Select(w => $"{w.Id}{w.BusMessageName}").ToList(); - return list; + var file = new XchangeFile(xchangeDetails.Data, xchangeDetails.FileName, xchangeDetails.BadData); + await CreateXchange(subscription, file, xchangeDetails.References); + _dbContext.Remove(xchangeDetails); } + await _dbContext.SaveChangesAsync(); + } + + public async Task> GetMessageTypeNames() + { + var messageTypeNamesWithOptions = await GetMessageTypeNamesWithOptions(); + return messageTypeNamesWithOptions.Keys; + } + - public Task Process(string messageTypeName, string message) + public Task Process(string messageTypeName, string message) + { + var eventMessage = JsonConvert.DeserializeObject(message); + return Process(eventMessage); + } + + public async Task> GetMessageTypeNamesWithOptions() + { + var workgroups = (await _BitweenCache.ListWorkGroupsAsync()).ToList(); + workgroups.Add(WorkGroup.None); + var dict = new Dictionary(); + foreach (var w in workgroups) + { + var messageTypeName = $"{w.Id}{w.BusMessageName}"; + dict[messageTypeName] = w.Options.RabbitMqOptions; + } + + if (_BitweenSettings.ConsumeLegacyEventMessages) { - var eventMessage = JsonConvert.DeserializeObject(message); - return Process(eventMessage); + dict.Add(nameof(ApiXchangeCreatedEvent), new ConsumerOptions(){Priority = 10}); + dict.Add(nameof(InternalXchangeCreatedEvent), new ConsumerOptions()); + dict.Add(nameof(ReceivingXchangeCreatedEvent), new ConsumerOptions()); + dict.Add(nameof(AggregateXchangeCreatedEvent), new ConsumerOptions()); } + return dict; } } \ No newline at end of file diff --git a/SW.Bitween.Web/SW.Bitween.Web.csproj b/SW.Bitween.Web/SW.Bitween.Web.csproj index 83909fa6..6184ac65 100644 --- a/SW.Bitween.Web/SW.Bitween.Web.csproj +++ b/SW.Bitween.Web/SW.Bitween.Web.csproj @@ -15,7 +15,7 @@ - + From 57c7bd8314d5ad2f705e0f4c60e9fd1d00abc003 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Wed, 21 Jan 2026 11:21:14 +0300 Subject: [PATCH 3/8] Implement WorkGroup support in Xchange processing and introduce IHasWorkGroup interface --- SW.Bitween.Api/Data/BitweenDbContext.cs | 15 +-- .../Domain/Subscription/Subscription.cs | 9 +- .../{Subscription => WorkGroup}/WorkGroup.cs | 11 ++- SW.Bitween.Api/Domain/Xchange/Xchange.cs | 4 +- .../Domain/Xchange/XchangeCreatedEvent.cs | 13 +-- .../Domain/XchangeResult/XchangeResult.cs | 5 +- .../XchangeResultCreatedEvent.cs | 4 +- SW.Bitween.Api/Interfaces/IHasWorkGroup.cs | 7 ++ SW.Bitween.Api/Interfaces/IInfolinkCache.cs | 1 + SW.Bitween.Api/Resources/Subscriptions/Get.cs | 1 + .../Resources/Subscriptions/Search.cs | 1 + .../Services/Caching/InMemoryInfolinkCache.cs | 8 ++ SW.Bitween.Api/Services/XchangeService.cs | 98 ++++++++++--------- SW.Bitween.Sdk/Model/Subscription.cs | 1 + 14 files changed, 108 insertions(+), 70 deletions(-) rename SW.Bitween.Api/Domain/{Subscription => WorkGroup}/WorkGroup.cs (59%) create mode 100644 SW.Bitween.Api/Interfaces/IHasWorkGroup.cs diff --git a/SW.Bitween.Api/Data/BitweenDbContext.cs b/SW.Bitween.Api/Data/BitweenDbContext.cs index eecdcd96..9f61160b 100644 --- a/SW.Bitween.Api/Data/BitweenDbContext.cs +++ b/SW.Bitween.Api/Data/BitweenDbContext.cs @@ -313,19 +313,14 @@ async public override Task SaveChangesAsync(CancellationToken cancellationT var events = entity.Events.ToArray(); entity.Events.Clear(); foreach (var domainEvent in events) - { - if(domainEvent is XchangeCreatedEvent xchangeCreatedEvent) - { - - await publish.Publish(domainEvent.GetType().Name, JsonConvert.SerializeObject(new XchangeCreatedMessage{Id = xchangeCreatedEvent.Id})); - } + if (domainEvent is IHasWorkGroup hasWorkGroup) + await publish.Publish(hasWorkGroup.GetBusMessageName(), + JsonConvert.SerializeObject(new XchangeMessage { Id = hasWorkGroup.Id })); else await publish.Publish(domainEvent.GetType().Name, JsonConvert.SerializeObject(domainEvent)); - } } - - - + + return affectedRecords; } } diff --git a/SW.Bitween.Api/Domain/Subscription/Subscription.cs b/SW.Bitween.Api/Domain/Subscription/Subscription.cs index deed91d0..3664494b 100644 --- a/SW.Bitween.Api/Domain/Subscription/Subscription.cs +++ b/SW.Bitween.Api/Domain/Subscription/Subscription.cs @@ -14,20 +14,20 @@ public Subscription() } //receiving - public Subscription(string name, int documentId) : this(name, documentId, SubscriptionType.Receiving) + public Subscription(string name, int documentId) : this(WorkGroup.None, name, documentId, SubscriptionType.Receiving) { Inactive = true; } //aggregation - public Subscription(string name, int aggregationFor, int partnerId) : this(name, Document.AggregationDocumentId, + public Subscription(string name, int aggregationFor, int partnerId) : this(WorkGroup.None,name, Document.AggregationDocumentId, SubscriptionType.Aggregation, partnerId, aggregationFor) { Inactive = true; } //apiresult or filter - public Subscription(string name, int documentId, SubscriptionType type, int partnerId) : this(name, documentId, + public Subscription(string name, int documentId, SubscriptionType type, int partnerId) : this(WorkGroup.None,name, documentId, type, partnerId, null) { Inactive = true; @@ -35,7 +35,7 @@ public Subscription(string name, int documentId, SubscriptionType type, int part throw new ArgumentException(); } - private Subscription(string name, int documentId, SubscriptionType type, int? partnerId = null, + private Subscription(WorkGroup workGroup, string name, int documentId, SubscriptionType type, int? partnerId = null, int? aggregationForId = null, bool temporary = false) { Inactive = true; @@ -51,6 +51,7 @@ private Subscription(string name, int documentId, SubscriptionType type, int? pa ValidatorProperties = new Dictionary(); DocumentFilter = new Dictionary(); Temporary = temporary; + WorkGroup = workGroup; } public string Name { get; set; } diff --git a/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs b/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs similarity index 59% rename from SW.Bitween.Api/Domain/Subscription/WorkGroup.cs rename to SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs index 3781fc64..7309e4fa 100644 --- a/SW.Bitween.Api/Domain/Subscription/WorkGroup.cs +++ b/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs @@ -3,14 +3,23 @@ namespace SW.Bitween.Domain; +public interface IWorkGroup +{ + string BusMessageName { get; } + string GetBusMessageName(); + WorkGroupOptions Options { get; } +} public class WorkGroupOptions { public ConsumerOptions RabbitMqOptions { get; set; } } -public class WorkGroup : BaseEntity +public class WorkGroup : BaseEntity,IWorkGroup { public string Name { get; set; } public string BusMessageName { get; set; } + + public string GetBusMessageName() => $"{Id}{BusMessageName}"; + //public string public static WorkGroup None => new() { BusMessageName = "Ungrouped"}; public WorkGroupOptions Options { get; set; } } \ No newline at end of file diff --git a/SW.Bitween.Api/Domain/Xchange/Xchange.cs b/SW.Bitween.Api/Domain/Xchange/Xchange.cs index d78d3a37..879708c8 100644 --- a/SW.Bitween.Api/Domain/Xchange/Xchange.cs +++ b/SW.Bitween.Api/Domain/Xchange/Xchange.cs @@ -11,7 +11,7 @@ private Xchange() { } - public Xchange(int documentId, WorkGroup workGroup, XchangeFile file, string[] references = null, SubscriptionType subscriptionType = SubscriptionType.Internal, string correlationId = null) + public Xchange(int documentId, IWorkGroup workGroup, XchangeFile file, string[] references = null, SubscriptionType subscriptionType = SubscriptionType.Internal, string correlationId = null) { Id = Guid.NewGuid().ToString("N"); DocumentId = documentId; @@ -52,7 +52,7 @@ public Xchange(Subscription subscription, XchangeFile file, string[] references } //retry xchange - public Xchange(Xchange xchange, XchangeFile file,WorkGroup workGroup) : + public Xchange(Xchange xchange, XchangeFile file,IWorkGroup workGroup) : this(xchange.DocumentId,workGroup, file, xchange.References) { SubscriptionId = xchange.SubscriptionId; diff --git a/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs b/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs index b5c8e51f..734d4b71 100644 --- a/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs +++ b/SW.Bitween.Api/Domain/Xchange/XchangeCreatedEvent.cs @@ -3,16 +3,17 @@ namespace SW.Bitween.Domain { - - internal abstract class XchangeCreatedEvent : BaseDomainEvent + internal class XchangeMessage { public string Id { get; set; } - public WorkGroup WorkGroup { get; set; } - } - internal class XchangeCreatedMessage:XchangeCreatedEvent + internal abstract class XchangeCreatedEvent : BaseDomainEvent,IHasWorkGroup { - + public string Id { get; set; } + public string GetBusMessageName()=> WorkGroup.GetBusMessageName(); + + public IWorkGroup WorkGroup { get; set; } + } internal class ApiXchangeCreatedEvent : XchangeCreatedEvent { diff --git a/SW.Bitween.Api/Domain/XchangeResult/XchangeResult.cs b/SW.Bitween.Api/Domain/XchangeResult/XchangeResult.cs index dec7e161..ac674785 100644 --- a/SW.Bitween.Api/Domain/XchangeResult/XchangeResult.cs +++ b/SW.Bitween.Api/Domain/XchangeResult/XchangeResult.cs @@ -9,7 +9,7 @@ private XchangeResult() { } - public XchangeResult(string xchangeId, XchangeFile outputFile, XchangeFile responseFile = null, string responseXchangeId = null, string exception = null) + public XchangeResult(string xchangeId,WorkGroup workGroup, XchangeFile outputFile, XchangeFile responseFile = null, string responseXchangeId = null, string exception = null) { Id = xchangeId; Success = exception == null; @@ -40,7 +40,8 @@ public XchangeResult(string xchangeId, XchangeFile outputFile, XchangeFile respo { Id = Id, Success = Success, - ResponseBad = ResponseBad + ResponseBad = ResponseBad, + WorkGroup = workGroup ?? WorkGroup.None, }); } diff --git a/SW.Bitween.Api/Domain/XchangeResult/XchangeResultCreatedEvent.cs b/SW.Bitween.Api/Domain/XchangeResult/XchangeResultCreatedEvent.cs index ffe36944..3a38cfe7 100644 --- a/SW.Bitween.Api/Domain/XchangeResult/XchangeResultCreatedEvent.cs +++ b/SW.Bitween.Api/Domain/XchangeResult/XchangeResultCreatedEvent.cs @@ -2,10 +2,12 @@ namespace SW.Bitween.Domain { - public class XchangeResultCreatedEvent : BaseDomainEvent + public class XchangeResultCreatedEvent : BaseDomainEvent,IHasWorkGroup { public string Id { get; set; } public bool Success { get; set; } public bool ResponseBad { get; set; } + public IWorkGroup WorkGroup { get; set; } = Domain.WorkGroup.None; + public string GetBusMessageName()=> $"{WorkGroup.GetBusMessageName()}{XchangeService.ResultQueueSuffix}"; } } diff --git a/SW.Bitween.Api/Interfaces/IHasWorkGroup.cs b/SW.Bitween.Api/Interfaces/IHasWorkGroup.cs new file mode 100644 index 00000000..9b23a087 --- /dev/null +++ b/SW.Bitween.Api/Interfaces/IHasWorkGroup.cs @@ -0,0 +1,7 @@ +namespace SW.Bitween; + +public interface IHasWorkGroup +{ + public string Id { get; } + string GetBusMessageName(); +} \ No newline at end of file diff --git a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs index 9ed002d3..a4666711 100644 --- a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs +++ b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs @@ -18,4 +18,5 @@ public interface IInfolinkCache Task ListWorkGroupsAsync(); Task WorkGroupByIdAsync(int workGroupId); + Task WorkGroupBySubscriptionIdAsync(int subscriptionId); } \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/Subscriptions/Get.cs b/SW.Bitween.Api/Resources/Subscriptions/Get.cs index 2961af33..3bdc6b66 100644 --- a/SW.Bitween.Api/Resources/Subscriptions/Get.cs +++ b/SW.Bitween.Api/Resources/Subscriptions/Get.cs @@ -52,6 +52,7 @@ public async Task Handle(int key) CategoryDescription = subscriber.Category?.Description, CategoryCode = subscriber.Category?.Code, CategoryId = subscriber.CategoryId, + WorkGroupId = subscriber.WorkGroupId, Schedules = subscriber.Schedules.Select(s => new ScheduleView { Backwards = s.Backwards, diff --git a/SW.Bitween.Api/Resources/Subscriptions/Search.cs b/SW.Bitween.Api/Resources/Subscriptions/Search.cs index 8148d386..fd829451 100644 --- a/SW.Bitween.Api/Resources/Subscriptions/Search.cs +++ b/SW.Bitween.Api/Resources/Subscriptions/Search.cs @@ -59,6 +59,7 @@ join document in _dbContext.Set() on subscriber.DocumentId equals docu MatchExpression = subscriber.MatchExpression, PartnerId = subscriber.PartnerId, CategoryId = subscriber.CategoryId, + WorkGroupId = subscriber.WorkGroupId, CategoryDescription = subscriber.Category.Description, CategoryCode = subscriber.Category.Code }; diff --git a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs index 12047859..b32db86e 100644 --- a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs +++ b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs @@ -133,6 +133,14 @@ public async Task WorkGroupByIdAsync(int workGroupId) return cachedWorkGroups.FirstOrDefault(wg => wg.Id == workGroupId); } + public async Task WorkGroupBySubscriptionIdAsync(int subscriptionId) + { + var subscription = await SubscriptionByIdAsync(subscriptionId); + if (subscription?.WorkGroupId == null) + return null; + + return await WorkGroupByIdAsync(subscription.WorkGroupId.Value); + } public void Revoke() { diff --git a/SW.Bitween.Api/Services/XchangeService.cs b/SW.Bitween.Api/Services/XchangeService.cs index 02bb9a5a..ce3c6cb6 100644 --- a/SW.Bitween.Api/Services/XchangeService.cs +++ b/SW.Bitween.Api/Services/XchangeService.cs @@ -15,15 +15,16 @@ namespace SW.Bitween; public class XchangeService : - IConsume, - IConsume, - IConsume, - IConsume, - IConsume, + // IConsume, + // IConsume, + // IConsume, + // IConsume, + // IConsume, IConsume, IConsumeExtended { + public const string ResultQueueSuffix = "-Result"; private readonly BitweenOptions _BitweenSettings; private readonly BitweenDbContext _dbContext; private readonly FilterService _filterService; @@ -66,12 +67,13 @@ public async Task SubmitFilterXchange(int documentId, XchangeFile file, string[] if (document?.DisregardsUnfilteredMessages ?? false) { - var result = await _filterService.Filter(documentId, file); - await CreateXchangesForHits(correlationId, result, file); + xchange = new Xchange(documentId, null, file, references, SubscriptionType.Internal, correlationId); + var result = await _filterService.Filter(xchange.DocumentId, file); + await CreateXchangesForHits(xchange, result, file); } else { - await CreateXchange(document, file, references, correlationId); + xchange = await CreateXchange(document, null, file, references, correlationId); } await _dbContext.SaveChangesAsync(); @@ -79,7 +81,7 @@ public async Task SubmitFilterXchange(int documentId, XchangeFile file, string[] public async Task CreateXchange(Xchange xchange, XchangeFile file, WorkGroup workGroup) { - var newXchange = new Xchange(xchange, file,workGroup); + var newXchange = new Xchange(xchange, file, workGroup); await AddFile(newXchange.Id, XchangeFileType.Input, file); _dbContext.Add(newXchange); } @@ -92,10 +94,11 @@ public async Task CreateXchange(Subscription subscription, Xchange xchange, Xcha _dbContext.Add(newXchange); } - public async Task CreateXchange(Document document, WorkGroup workGroup, XchangeFile file, string[] references = null, + public async Task CreateXchange(Document document, WorkGroup workGroup, XchangeFile file, + string[] references = null, string correlationId = null) { - var xchange = new Xchange(document.Id,workGroup, file, references, SubscriptionType.Internal, correlationId); + var xchange = new Xchange(document.Id, workGroup, file, references, SubscriptionType.Internal, correlationId); await AddFile(xchange.Id, XchangeFileType.Input, file); _dbContext.Add(xchange); return xchange; @@ -208,12 +211,12 @@ public async Task GetFile(string xchangeId, XchangeFileType type) return await reader.ReadToEndAsync(); } - private async Task Process(XchangeCreatedEvent message) + private async Task Process(XchangeMessage message) { Xchange responseXchange = null; XchangeFile outputFile = null; XchangeFile responseFile = null; - + WorkGroup workGroup = null; var xchange = await _dbContext.FindAsync(message.Id); if (xchange == null) throw new BitweenException($"Xchange '{message.Id}' not found."); @@ -227,6 +230,7 @@ private async Task Process(XchangeCreatedEvent message) if (xchange.SubscriptionId != null) { + workGroup = await _BitweenCache.WorkGroupBySubscriptionIdAsync(xchange.SubscriptionId.Value); if (xchange.MapperId == null) responseFile = await RunHandler(xchange, inputFile); else @@ -254,19 +258,19 @@ private async Task Process(XchangeCreatedEvent message) await CreateXchangesForHits(xchange, result, inputFile); } - _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id)); + _dbContext.Add(new XchangeResult(xchange.Id, workGroup, outputFile, responseFile, responseXchange?.Id)); await _dbContext.SaveChangesAsync(); } catch (Exception ex) { - _dbContext.Add(new XchangeResult(xchange.Id, outputFile, responseFile, responseXchange?.Id, + _dbContext.Add(new XchangeResult(xchange.Id, workGroup, outputFile, responseFile, responseXchange?.Id, ex.ToString())); await _dbContext.SaveChangesAsync(); } } - async Task CreateXchangesForHits(string correlationId, FilterResult result, XchangeFile inputFile) + async Task CreateXchangesForHits(Xchange xchange, FilterResult result, XchangeFile inputFile) { foreach (var subscriptionId in result.Hits) { @@ -277,27 +281,30 @@ async Task CreateXchangesForHits(string correlationId, FilterResult result, Xcha } else { - await CreateXchange(subscription, inputFile, null, correlationId); + await CreateXchange(subscription, inputFile, null, xchange.CorrelationId); } } } - Task IConsume.Process(ApiXchangeCreatedEvent message) => Process(message); - - Task IConsume.Process(AggregateXchangeCreatedEvent message) => Process(message); - - Task IConsume.Process(InternalXchangeCreatedEvent message) => Process(message); + // Task IConsume.Process(ApiXchangeCreatedEvent message) => Process(message); + // + // Task IConsume.Process(AggregateXchangeCreatedEvent message) => Process(message); + // + // Task IConsume.Process(InternalXchangeCreatedEvent message) => Process(message); + // + // Task IConsume.Process(ReceivingXchangeCreatedEvent message) => Process(message); - Task IConsume.Process(ReceivingXchangeCreatedEvent message) => Process(message); - - public async Task Process(XchangeResultCreatedEvent message) + private async Task ProcessResult(XchangeMessage message) { var notifiers = await _BitweenCache.ListNotifiersAsync(); var xchangeResult = await _dbContext.FindAsync(message.Id); - + if (xchangeResult == null) + throw new BitweenException($"Xchange Result '{message.Id}' not found."); var xchange = await _dbContext.FindAsync(message.Id); + if (xchange == null) + throw new BitweenException($"Xchange '{message.Id}' not found."); foreach (var notifier in notifiers) { @@ -310,10 +317,10 @@ public async Task Process(XchangeResultCreatedEvent message) } - switch (message.Success) + switch (xchangeResult.Success) { - case true when !message.ResponseBad && notifier.RunOnSuccessfulResult: - case true when message.ResponseBad && notifier.RunOnBadResult: + case true when !xchangeResult.ResponseBad && notifier.RunOnSuccessfulResult: + case true when xchangeResult.ResponseBad && notifier.RunOnBadResult: case false when notifier.RunOnFailedResult: await NotifyResult(notifier, xchangeResult, xchange?.CorrelationId ?? xchange?.Id); break; @@ -393,31 +400,34 @@ public async Task> GetMessageTypeNames() return messageTypeNamesWithOptions.Keys; } - + public Task Process(string messageTypeName, string message) { - var eventMessage = JsonConvert.DeserializeObject(message); - return Process(eventMessage); + var eventMessage = JsonConvert.DeserializeObject(message); + + return messageTypeName.EndsWith(ResultQueueSuffix) ? ProcessResult(eventMessage) : Process(eventMessage); } public async Task> GetMessageTypeNamesWithOptions() { var workgroups = (await _BitweenCache.ListWorkGroupsAsync()).ToList(); workgroups.Add(WorkGroup.None); - var dict = new Dictionary(); - foreach (var w in workgroups) + var messageTypeNamesWithOptions = new Dictionary(); + foreach (var workGroup in workgroups) { - var messageTypeName = $"{w.Id}{w.BusMessageName}"; - dict[messageTypeName] = w.Options.RabbitMqOptions; + var messageTypeName = workGroup.GetBusMessageName(); + messageTypeNamesWithOptions[messageTypeName] = workGroup.Options.RabbitMqOptions; + var messageTypeNameForResponse = $"{messageTypeName}{ResultQueueSuffix}"; + messageTypeNamesWithOptions[messageTypeNameForResponse] = workGroup.Options.RabbitMqOptions; } - if (_BitweenSettings.ConsumeLegacyEventMessages) - { - dict.Add(nameof(ApiXchangeCreatedEvent), new ConsumerOptions(){Priority = 10}); - dict.Add(nameof(InternalXchangeCreatedEvent), new ConsumerOptions()); - dict.Add(nameof(ReceivingXchangeCreatedEvent), new ConsumerOptions()); - dict.Add(nameof(AggregateXchangeCreatedEvent), new ConsumerOptions()); - } - return dict; + if (!_BitweenSettings.ConsumeLegacyEventMessages) return messageTypeNamesWithOptions; + + messageTypeNamesWithOptions.Add(nameof(ApiXchangeCreatedEvent), new ConsumerOptions() { Priority = 10 }); + messageTypeNamesWithOptions.Add(nameof(InternalXchangeCreatedEvent), new ConsumerOptions()); + messageTypeNamesWithOptions.Add(nameof(ReceivingXchangeCreatedEvent), new ConsumerOptions()); + messageTypeNamesWithOptions.Add(nameof(AggregateXchangeCreatedEvent), new ConsumerOptions()); + messageTypeNamesWithOptions.Add(nameof(XchangeResultCreatedEvent), new ConsumerOptions()); + return messageTypeNamesWithOptions; } } \ No newline at end of file diff --git a/SW.Bitween.Sdk/Model/Subscription.cs b/SW.Bitween.Sdk/Model/Subscription.cs index 646d5a57..7dae4617 100644 --- a/SW.Bitween.Sdk/Model/Subscription.cs +++ b/SW.Bitween.Sdk/Model/Subscription.cs @@ -62,6 +62,7 @@ public class SubscriptionUpdate : SubscriptionCreate public string ReceiverId { get; set; } public string ValidatorId { get; set; } public int? CategoryId { get; set; } + public int? WorkGroupId { get; set; } public bool Temporary { get; set; } public IPropertyMatchSpecification MatchExpression { get; set; } From 52a333e9488c1503079d4b52d70bd46c1d17cce3 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Wed, 21 Jan 2026 20:07:32 +0300 Subject: [PATCH 4/8] Add WorkGroup support to Subscriptions and update schema references --- SW.Bitween.Api/Data/BitweenDbContext.cs | 10 + SW.Bitween.Api/Services/BitweenOptions.cs | 2 + ...21164302_SubscriptionWorkGroup.Designer.cs | 984 ++++++++++++++ .../20260121164302_SubscriptionWorkGroup.cs | 66 + ...ot.cs => BitweenDbContextModelSnapshot.cs} | 62 +- ...ot.cs => BitweenDbContextModelSnapshot.cs} | 63 +- SW.Bitween.PgSql/BitweenDbContext.cs | 10 +- .../20201112232518_Initial.Designer.cs | 22 +- .../Migrations/20201112232518_Initial.cs | 98 +- .../20210418102152_update1.Designer.cs | 22 +- .../Migrations/20210418102152_update1.cs | 8 +- .../20210612111308_update2.Designer.cs | 24 +- .../Migrations/20210612111308_update2.cs | 4 +- .../20210630180119_update3.Designer.cs | 26 +- .../Migrations/20210630180119_update3.cs | 4 +- .../20210701125443_update4.Designer.cs | 28 +- .../Migrations/20210701125443_update4.cs | 10 +- .../20210704084741_update5.Designer.cs | 28 +- .../Migrations/20210704084741_update5.cs | 12 +- .../20210830182418_update6.Designer.cs | 28 +- .../Migrations/20210830182418_update6.cs | 4 +- .../20210925081545_update7.Designer.cs | 28 +- .../Migrations/20210925081545_update7.cs | 4 +- .../20211108154104_update8.Designer.cs | 28 +- .../Migrations/20211108154104_update8.cs | 4 +- .../20220414101356_update9.Designer.cs | 34 +- .../Migrations/20220414101356_update9.cs | 92 +- .../20220816114929_XMLSupport.Designer.cs | 34 +- .../Migrations/20220816114929_XMLSupport.cs | 4 +- .../20221221093002_update11.Designer.cs | 34 +- .../Migrations/20221221093002_update11.cs | 4 +- .../20221229124737_update12.Designer.cs | 34 +- .../Migrations/20221229124737_update12.cs | 8 +- .../20221229130845_update13.Designer.cs | 34 +- .../Migrations/20221229130845_update13.cs | 4 +- .../20230129072000_update14.Designer.cs | 34 +- .../Migrations/20230129072000_update14.cs | 8 +- .../20230207095105_update15.Designer.cs | 38 +- .../Migrations/20230207095105_update15.cs | 24 +- .../20230220104919_update_16.Designer.cs | 38 +- .../Migrations/20230220104919_update_16.cs | 4 +- ...910151704_SubscriptionCategory.Designer.cs | 40 +- .../20230910151704_SubscriptionCategory.cs | 20 +- ...21132821_SubscriptionWorkGroup.Designer.cs | 1167 +++++++++++++++++ .../20260121132821_SubscriptionWorkGroup.cs | 488 +++++++ ...ot.cs => BitweenDbContextModelSnapshot.cs} | 97 +- SW.Bitween.Web/Startup.cs | 2 +- 47 files changed, 3344 insertions(+), 477 deletions(-) create mode 100644 SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.Designer.cs create mode 100644 SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.cs rename SW.Bitween.MsSql/Migrations/{InfolinkDbContextModelSnapshot.cs => BitweenDbContextModelSnapshot.cs} (95%) rename SW.Bitween.MySql/Migrations/{InfolinkDbContextModelSnapshot.cs => BitweenDbContextModelSnapshot.cs} (93%) create mode 100644 SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs create mode 100644 SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs rename SW.Bitween.PgSql/Migrations/{InfolinkDbContextModelSnapshot.cs => BitweenDbContextModelSnapshot.cs} (93%) diff --git a/SW.Bitween.Api/Data/BitweenDbContext.cs b/SW.Bitween.Api/Data/BitweenDbContext.cs index 9f61160b..77295fd6 100644 --- a/SW.Bitween.Api/Data/BitweenDbContext.cs +++ b/SW.Bitween.Api/Data/BitweenDbContext.cs @@ -82,6 +82,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) sc.Property(i => i.Id).ValueGeneratedOnAdd(); sc.HasIndex(i => i.Code).IsUnique(); }); + + modelBuilder.Entity(wg => + { + wg.HasKey(i => i.Id); + wg.Property(i => i.Id).ValueGeneratedOnAdd(); + wg.Property(p => p.BusMessageName).IsRequired().IsUnicode(false).HasMaxLength(100); + wg.Property(p => p.Options).StoreAsJson(); + + }); modelBuilder.Entity(b => { @@ -148,6 +157,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) b.HasOne().WithMany().HasForeignKey(p => p.AggregationForId).IsRequired(false) .HasConstraintName("FK_Subscriptions_AggFor").OnDelete(DeleteBehavior.Restrict); b.HasOne(i => i.Category).WithMany().HasForeignKey(i => i.CategoryId); + b.HasOne(i => i.WorkGroup).WithMany().HasForeignKey(i => i.WorkGroupId); b.Property(p => p.MatchExpression).HasConversion( domainObject => domainObject == null ? null : MatchSpecValueConverter.SerializeMatchSpec(domainObject), diff --git a/SW.Bitween.Api/Services/BitweenOptions.cs b/SW.Bitween.Api/Services/BitweenOptions.cs index 2f9b545e..825fce23 100644 --- a/SW.Bitween.Api/Services/BitweenOptions.cs +++ b/SW.Bitween.Api/Services/BitweenOptions.cs @@ -19,6 +19,7 @@ public BitweenOptions() StorageProvider = "S3"; JwtExpiryMinutes = 60; BusDefaultQueuePrefetch = 12; + QueuePrefix="bitween"; } public ushort? BusDefaultQueuePrefetch { get; set; } @@ -43,5 +44,6 @@ public BitweenOptions() public string MsalTenantId { get; set; } public int JwtExpiryMinutes { get; set; } public bool ConsumeLegacyEventMessages { get; set; } + public string QueuePrefix { get; set; } } } \ No newline at end of file diff --git a/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.Designer.cs b/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.Designer.cs new file mode 100644 index 00000000..1f797314 --- /dev/null +++ b/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.Designer.cs @@ -0,0 +1,984 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SW.Bitween; + +#nullable disable + +namespace SW.Bitween.MsSql.Migrations +{ + [DbContext(typeof(BitweenDbContext))] + [Migration("20260121164302_SubscriptionWorkGroup")] + partial class SubscriptionWorkGroup + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Deleted") + .HasColumnType("bit"); + + b.Property("Disabled") + .HasColumnType("bit"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Email") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("EmailProvider") + .HasColumnType("tinyint"); + + b.Property("LoginMethods") + .HasColumnType("tinyint"); + + b.Property("ModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Password") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("Phone") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("varchar(20)"); + + b.Property("Role") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique() + .HasFilter("[Email] IS NOT NULL"); + + b.ToTable("Accounts", (string)null); + + b.HasData( + new + { + Id = 9999, + CreatedOn = new DateTime(2021, 12, 31, 22, 0, 0, 0, DateTimeKind.Utc), + Deleted = false, + Disabled = false, + DisplayName = "Admin", + Email = "admin@Bitween.systems", + EmailProvider = (byte)0, + LoginMethods = (byte)2, + Password = "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", + Role = 0 + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("AccountId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("LoginMethod") + .HasColumnType("tinyint"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("RefreshTokens", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Document", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BusEnabled") + .HasColumnType("bit"); + + b.Property("BusMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("DisregardsUnfilteredMessages") + .HasColumnType("bit"); + + b.Property("DocumentFormat") + .HasColumnType("int"); + + b.Property("DuplicateInterval") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("PromotedProperties") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BusMessageTypeName") + .IsUnique() + .HasFilter("[BusMessageTypeName] IS NOT NULL"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Documents", (string)null); + + b.HasData( + new + { + Id = 10001, + BusEnabled = false, + DocumentFormat = 0, + DuplicateInterval = 0, + Name = "Aggregation Document", + PromotedProperties = "{}" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("StateAfter") + .HasColumnType("nvarchar(max)"); + + b.Property("StateBefore") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("DocumentId"); + + b.ToTable("DocumentTrail"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Inactive") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RunOnBadResult") + .HasColumnType("bit"); + + b.Property("RunOnFailedResult") + .HasColumnType("bit"); + + b.Property("RunOnSubscriptions") + .HasColumnType("nvarchar(max)"); + + b.Property("RunOnSuccessfulResult") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("Notifiers", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BadData") + .HasColumnType("bit"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("References") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("OnHoldXchanges", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Partners", (string)null); + + b.HasData( + new + { + Id = 1, + Name = "SYSTEM" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AggregateOn") + .HasColumnType("datetime2"); + + b.Property("AggregationForId") + .HasColumnType("int"); + + b.Property("AggregationTarget") + .HasColumnType("tinyint"); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ConsecutiveFailures") + .HasColumnType("int"); + + b.Property("DocumentFilter") + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Inactive") + .HasColumnType("bit"); + + b.Property("IsRunning") + .HasColumnType("bit"); + + b.Property("LastException") + .HasColumnType("nvarchar(max)"); + + b.Property("MapperId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("MapperProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("MatchExpression") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PartnerId") + .HasColumnType("int"); + + b.Property("PausedOn") + .HasColumnType("datetime2"); + + b.Property("ReceiveOn") + .HasColumnType("datetime2"); + + b.Property("ReceiverId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ReceiverProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("int"); + + b.Property("Temporary") + .HasColumnType("bit"); + + b.Property("Type") + .HasColumnType("tinyint"); + + b.Property("ValidatorId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ValidatorProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkGroupId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AggregationForId"); + + b.HasIndex("CategoryId"); + + b.HasIndex("DocumentId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("ResponseSubscriptionId"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("Subscriptions", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Code") + .HasColumnType("nvarchar(450)"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("Code") + .IsUnique() + .HasFilter("[Code] IS NOT NULL"); + + b.ToTable("SubscriptionCategory"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("StateAfter") + .HasColumnType("nvarchar(max)"); + + b.Property("StateBefore") + .HasColumnType("nvarchar(max)"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("SubscriptionTrail"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Options") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WorkGroup"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("CorrelationId") + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("InputContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("InputHash") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("InputName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("InputSize") + .HasColumnType("int"); + + b.Property("MapperId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("MapperProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("References") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("int"); + + b.Property("RetryFor") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("StartedOn") + .HasColumnType("datetime2"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InputHash"); + + b.HasIndex("RetryFor"); + + b.HasIndex("StartedOn"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("Xchanges", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("AggregatedOn") + .HasColumnType("datetime2"); + + b.Property("AggregationXchangeId") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("AggregationXchangeId"); + + b.ToTable("XchangeAggregations", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("DeliveredOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DeliveredOn"); + + b.ToTable("XchangeDeliveries", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("FinishedOn") + .HasColumnType("datetime2"); + + b.Property("NotifierId") + .HasColumnType("int"); + + b.Property("NotifierName") + .HasColumnType("nvarchar(max)"); + + b.Property("Success") + .HasColumnType("bit"); + + b.Property("XchangeId") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.ToTable("XchangeNotifications", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("Hits") + .HasMaxLength(2000) + .IsUnicode(false) + .HasColumnType("varchar(2000)"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("PropertiesRaw") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("PropertiesRaw"); + + b.ToTable("XchangePromotedProperties", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("FinishedOn") + .HasColumnType("datetime2"); + + b.Property("OutputBad") + .HasColumnType("bit"); + + b.Property("OutputContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("OutputHash") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("OutputName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OutputSize") + .HasColumnType("int"); + + b.Property("ResponseBad") + .HasColumnType("bit"); + + b.Property("ResponseContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ResponseHash") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("ResponseName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ResponseSize") + .HasColumnType("int"); + + b.Property("ResponseXchangeId") + .HasColumnType("nvarchar(max)"); + + b.Property("Success") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("XchangeResults", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => + { + b.Property("IsRunning") + .HasColumnType("bit"); + + b.ToTable((string)null); + + b.ToView(null, (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.HasOne("SW.Bitween.Domain.Accounts.Account", null) + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.HasOne("SW.Bitween.Domain.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.OwnsMany("SW.Bitween.Domain.ApiCredential", "ApiCredentials", b1 => + { + b1.Property("PartnerId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Key") + .IsRequired() + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b1.HasKey("PartnerId", "Id"); + + b1.HasIndex("Key") + .IsUnique(); + + b1.ToTable("PartnerApiCredentials", (string)null); + + b1.WithOwner() + .HasForeignKey("PartnerId"); + + b1.HasData( + new + { + PartnerId = 1, + Id = 1, + Key = "7facc758283844b49cc4ffd26a75b1de", + Name = "default" + }); + }); + + b.Navigation("ApiCredentials"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("AggregationForId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_Subscriptions_AggFor"); + + b.HasOne("SW.Bitween.Domain.SubscriptionCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("SW.Bitween.Domain.Partner", null) + .WithMany("Subscriptions") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("ResponseSubscriptionId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_Subscriptions_RespSub"); + + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId"); + + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => + { + b1.Property("SubscriptionId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Backwards") + .HasColumnType("bit"); + + b1.Property("On") + .HasColumnType("bigint"); + + b1.Property("Recurrence") + .HasColumnType("tinyint"); + + b1.HasKey("SubscriptionId", "Id"); + + b1.ToTable("SubscriptionSchedules", (string)null); + + b1.WithOwner() + .HasForeignKey("SubscriptionId"); + }); + + b.Navigation("Category"); + + b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", "Subscription") + .WithMany() + .HasForeignKey("SubscriptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subscription"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeAggregation", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeDelivery", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangePromotedProperties", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeResult", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Navigation("Subscriptions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.cs b/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.cs new file mode 100644 index 00000000..533d17d9 --- /dev/null +++ b/SW.Bitween.MsSql/Migrations/20260121164302_SubscriptionWorkGroup.cs @@ -0,0 +1,66 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SW.Bitween.MsSql.Migrations +{ + /// + public partial class SubscriptionWorkGroup : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "WorkGroupId", + table: "Subscriptions", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "WorkGroup", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: true), + BusMessageName = table.Column(type: "varchar(100)", unicode: false, maxLength: 100, nullable: false), + Options = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkGroup", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Subscriptions_WorkGroupId", + table: "Subscriptions", + column: "WorkGroupId"); + + migrationBuilder.AddForeignKey( + name: "FK_Subscriptions_WorkGroup_WorkGroupId", + table: "Subscriptions", + column: "WorkGroupId", + principalTable: "WorkGroup", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Subscriptions_WorkGroup_WorkGroupId", + table: "Subscriptions"); + + migrationBuilder.DropTable( + name: "WorkGroup"); + + migrationBuilder.DropIndex( + name: "IX_Subscriptions_WorkGroupId", + table: "Subscriptions"); + + migrationBuilder.DropColumn( + name: "WorkGroupId", + table: "Subscriptions"); + } + } +} diff --git a/SW.Bitween.MsSql/Migrations/InfolinkDbContextModelSnapshot.cs b/SW.Bitween.MsSql/Migrations/BitweenDbContextModelSnapshot.cs similarity index 95% rename from SW.Bitween.MsSql/Migrations/InfolinkDbContextModelSnapshot.cs rename to SW.Bitween.MsSql/Migrations/BitweenDbContextModelSnapshot.cs index 5db30afe..aca44dbd 100644 --- a/SW.Bitween.MsSql/Migrations/InfolinkDbContextModelSnapshot.cs +++ b/SW.Bitween.MsSql/Migrations/BitweenDbContextModelSnapshot.cs @@ -17,10 +17,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.20") + .HasAnnotation("ProductVersion", "8.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("SW.Bitween.Domain.Accounts.Account", b => { @@ -28,7 +28,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("CreatedBy") .HasColumnType("nvarchar(max)"); @@ -217,7 +217,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("HandlerId") .HasMaxLength(200) @@ -258,7 +258,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("BadData") .HasColumnType("bit"); @@ -289,7 +289,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Name") .IsRequired() @@ -315,7 +315,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("AggregateOn") .HasColumnType("datetime2"); @@ -410,6 +410,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ValidatorProperties") .HasColumnType("nvarchar(max)"); + b.Property("WorkGroupId") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("AggregationForId"); @@ -422,6 +425,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId"); + b.HasIndex("WorkGroupId"); + b.ToTable("Subscriptions", (string)null); }); @@ -431,7 +436,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Code") .HasColumnType("nvarchar(450)"); @@ -493,6 +498,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("SubscriptionTrail"); }); + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Options") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WorkGroup"); + }); + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => { b.Property("Id") @@ -624,7 +654,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Exception") .HasColumnType("nvarchar(max)"); @@ -745,7 +775,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsRunning") .HasColumnType("bit"); - b.ToView(null); + b.ToTable((string)null); + + b.ToView(null, (string)null); }); modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => @@ -779,7 +811,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); b1.Property("Key") .IsRequired() @@ -844,6 +876,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("FK_Subscriptions_RespSub"); + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId"); + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => { b1.Property("SubscriptionId") @@ -853,7 +889,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); b1.Property("Backwards") .HasColumnType("bit"); @@ -875,6 +911,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Category"); b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => diff --git a/SW.Bitween.MySql/Migrations/InfolinkDbContextModelSnapshot.cs b/SW.Bitween.MySql/Migrations/BitweenDbContextModelSnapshot.cs similarity index 93% rename from SW.Bitween.MySql/Migrations/InfolinkDbContextModelSnapshot.cs rename to SW.Bitween.MySql/Migrations/BitweenDbContextModelSnapshot.cs index 6acde89b..c9560dbd 100644 --- a/SW.Bitween.MySql/Migrations/InfolinkDbContextModelSnapshot.cs +++ b/SW.Bitween.MySql/Migrations/BitweenDbContextModelSnapshot.cs @@ -2,6 +2,7 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using SW.Bitween; @@ -16,15 +17,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.20") + .HasAnnotation("ProductVersion", "8.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 64); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + modelBuilder.Entity("SW.Bitween.Domain.Accounts.Account", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreatedBy") .HasColumnType("longtext"); @@ -210,6 +215,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("HandlerId") .HasMaxLength(200) .IsUnicode(false) @@ -249,6 +256,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("BadData") .HasColumnType("tinyint(1)"); @@ -278,6 +287,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("Name") .IsRequired() .HasMaxLength(200) @@ -302,6 +313,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("AggregateOn") .HasColumnType("datetime(6)"); @@ -395,6 +408,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ValidatorProperties") .HasColumnType("longtext"); + b.Property("WorkGroupId") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("AggregationForId"); @@ -407,6 +423,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId"); + b.HasIndex("WorkGroupId"); + b.ToTable("Subscriptions", (string)null); }); @@ -416,6 +434,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("Code") .HasColumnType("varchar(255)"); @@ -475,6 +495,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("SubscriptionTrail"); }); + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("Options") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("WorkGroup"); + }); + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => { b.Property("Id") @@ -606,6 +651,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("Exception") .HasColumnType("longtext"); @@ -725,7 +772,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsRunning") .HasColumnType("tinyint(1)"); - b.ToView(null); + b.ToTable((string)null); + + b.ToView(null, (string)null); }); modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => @@ -759,6 +808,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b1.Property("Id")); + b1.Property("Key") .IsRequired() .HasMaxLength(500) @@ -822,6 +873,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("FK_Subscriptions_RespSub"); + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId"); + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => { b1.Property("SubscriptionId") @@ -831,6 +886,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b1.Property("Id")); + b1.Property("Backwards") .HasColumnType("tinyint(1)"); @@ -851,6 +908,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Category"); b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => diff --git a/SW.Bitween.PgSql/BitweenDbContext.cs b/SW.Bitween.PgSql/BitweenDbContext.cs index cd0c9ad9..0c4bc533 100644 --- a/SW.Bitween.PgSql/BitweenDbContext.cs +++ b/SW.Bitween.PgSql/BitweenDbContext.cs @@ -15,7 +15,7 @@ public class BitweenDbContext : Bitween.BitweenDbContext //private readonly RequestContext requestContext; //private readonly IPublish publish; - public const string Schema = "Bitween"; + public const string Schema = "bitween"; public BitweenDbContext(DbContextOptions options, RequestContext requestContext, IPublish publish) : base( options, requestContext, publish) @@ -73,6 +73,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) sc.HasIndex(i => i.Code).IsUnique(); }); + modelBuilder.Entity(wg => + { + wg.HasKey(i => i.Id); + wg.Property(i => i.Id).ValueGeneratedOnAdd(); + wg.Property(p => p.BusMessageName).IsRequired().IsUnicode(false).HasMaxLength(100); + wg.Property(p => p.Options).HasColumnType("jsonb"); + + }); modelBuilder.Entity(b => { //b.ToTable("Partners"); diff --git a/SW.Bitween.PgSql/Migrations/20201112232518_Initial.Designer.cs b/SW.Bitween.PgSql/Migrations/20201112232518_Initial.Designer.cs index c94a0703..194923c0 100644 --- a/SW.Bitween.PgSql/Migrations/20201112232518_Initial.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20201112232518_Initial.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -93,7 +93,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -225,7 +225,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -321,7 +321,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -347,7 +347,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -367,7 +367,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -388,7 +388,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_promoted_properties"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -463,7 +463,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -499,7 +499,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -570,7 +570,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20201112232518_Initial.cs b/SW.Bitween.PgSql/Migrations/20201112232518_Initial.cs index cf706be0..2540179a 100644 --- a/SW.Bitween.PgSql/Migrations/20201112232518_Initial.cs +++ b/SW.Bitween.PgSql/Migrations/20201112232518_Initial.cs @@ -10,11 +10,11 @@ public partial class Initial : Migration protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: "Bitween"); + name: "infolink"); migrationBuilder.CreateTable( name: "document", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false), @@ -31,7 +31,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "partner", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false) @@ -45,7 +45,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "xchange", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(maxLength: 50, nullable: false), @@ -71,7 +71,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_xchange_document_document_id", column: x => x.document_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "document", principalColumn: "id", onDelete: ReferentialAction.Restrict); @@ -79,7 +79,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "partner_api_credential", - schema: "Bitween", + schema: "infolink", columns: table => new { partner_id = table.Column(nullable: false), @@ -94,7 +94,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_api_credential_partner_partner_id", column: x => x.partner_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "partner", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -102,7 +102,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "subscription", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false) @@ -137,28 +137,28 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_subscription_aggregation_for", column: x => x.aggregation_for_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "fk_subscription_document_document_id", column: x => x.document_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "document", principalColumn: "id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "fk_subscription_partner_partner_id", column: x => x.partner_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "partner", principalColumn: "id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "fk_subscription_response_subscriber", column: x => x.response_subscription_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Restrict); @@ -166,7 +166,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "xchange_aggregation", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(maxLength: 50, nullable: false), @@ -179,7 +179,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_xchange_aggregation_xchange_xchange_id", column: x => x.id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "xchange", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -187,7 +187,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "xchange_delivery", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(maxLength: 50, nullable: false), @@ -199,7 +199,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_xchange_delivery_xchange_xchange_id", column: x => x.id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "xchange", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -207,7 +207,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "xchange_promoted_properties", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(maxLength: 50, nullable: false), @@ -220,7 +220,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_xchange_promoted_properties_xchange_xchange_id", column: x => x.id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "xchange", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -228,7 +228,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "xchange_result", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(maxLength: 50, nullable: false), @@ -253,7 +253,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_xchange_result_xchange_xchange_id", column: x => x.id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "xchange", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -261,7 +261,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "subscription_schedule", - schema: "Bitween", + schema: "infolink", columns: table => new { subscription_id = table.Column(nullable: false), @@ -277,114 +277,114 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_schedule_subscription_subscription_id", column: x => x.subscription_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "document", columns: new[] { "id", "bus_enabled", "bus_message_type_name", "duplicate_interval", "name", "promoted_properties" }, values: new object[] { 10001, false, null, 0, "Aggregation Document", "{}" }); migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "partner", columns: new[] { "id", "name" }, values: new object[] { 1, "SYSTEM" }); migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", columns: new[] { "partner_id", "id", "key", "name" }, values: new object[] { 1, 1, "7facc758283844b49cc4ffd26a75b1de", "default" }); migrationBuilder.CreateIndex( name: "ix_document_bus_message_type_name", - schema: "Bitween", + schema: "infolink", table: "document", column: "bus_message_type_name", unique: true); migrationBuilder.CreateIndex( name: "ix_document_name", - schema: "Bitween", + schema: "infolink", table: "document", column: "name", unique: true); migrationBuilder.CreateIndex( name: "ix_partner_api_credential_key", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", column: "key", unique: true); migrationBuilder.CreateIndex( name: "ix_subscription_aggregation_for_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "aggregation_for_id"); migrationBuilder.CreateIndex( name: "ix_subscription_document_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "document_id"); migrationBuilder.CreateIndex( name: "ix_subscription_partner_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "partner_id"); migrationBuilder.CreateIndex( name: "ix_subscription_response_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "response_subscription_id"); migrationBuilder.CreateIndex( name: "ix_xchange_document_id", - schema: "Bitween", + schema: "infolink", table: "xchange", column: "document_id"); migrationBuilder.CreateIndex( name: "ix_xchange_input_hash", - schema: "Bitween", + schema: "infolink", table: "xchange", column: "input_hash"); migrationBuilder.CreateIndex( name: "ix_xchange_retry_for", - schema: "Bitween", + schema: "infolink", table: "xchange", column: "retry_for"); migrationBuilder.CreateIndex( name: "ix_xchange_started_on", - schema: "Bitween", + schema: "infolink", table: "xchange", column: "started_on"); migrationBuilder.CreateIndex( name: "ix_xchange_subscription_id", - schema: "Bitween", + schema: "infolink", table: "xchange", column: "subscription_id"); migrationBuilder.CreateIndex( name: "ix_xchange_aggregation_aggregation_xchange_id", - schema: "Bitween", + schema: "infolink", table: "xchange_aggregation", column: "aggregation_xchange_id"); migrationBuilder.CreateIndex( name: "ix_xchange_delivery_delivered_on", - schema: "Bitween", + schema: "infolink", table: "xchange_delivery", column: "delivered_on"); } @@ -393,43 +393,43 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "partner_api_credential", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "subscription_schedule", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "xchange_aggregation", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "xchange_delivery", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "xchange_promoted_properties", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "xchange_result", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "subscription", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "xchange", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "partner", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "document", - schema: "Bitween"); + schema: "infolink"); } } } diff --git a/SW.Bitween.PgSql/Migrations/20210418102152_update1.Designer.cs b/SW.Bitween.PgSql/Migrations/20210418102152_update1.Designer.cs index 8905db44..3405dfe9 100644 --- a/SW.Bitween.PgSql/Migrations/20210418102152_update1.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210418102152_update1.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -93,7 +93,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -225,7 +225,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -321,7 +321,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -347,7 +347,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -367,7 +367,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -395,7 +395,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -470,7 +470,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -506,7 +506,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -577,7 +577,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210418102152_update1.cs b/SW.Bitween.PgSql/Migrations/20210418102152_update1.cs index d7c1f49e..8820409c 100644 --- a/SW.Bitween.PgSql/Migrations/20210418102152_update1.cs +++ b/SW.Bitween.PgSql/Migrations/20210418102152_update1.cs @@ -8,13 +8,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "properties_raw", - schema: "Bitween", + schema: "infolink", table: "xchange_promoted_properties", nullable: true); migrationBuilder.CreateIndex( name: "ix_xchange_promoted_properties_properties_raw", - schema: "Bitween", + schema: "infolink", table: "xchange_promoted_properties", column: "properties_raw"); } @@ -23,12 +23,12 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "ix_xchange_promoted_properties_properties_raw", - schema: "Bitween", + schema: "infolink", table: "xchange_promoted_properties"); migrationBuilder.DropColumn( name: "properties_raw", - schema: "Bitween", + schema: "infolink", table: "xchange_promoted_properties"); } } diff --git a/SW.Bitween.PgSql/Migrations/20210612111308_update2.Designer.cs b/SW.Bitween.PgSql/Migrations/20210612111308_update2.Designer.cs index 9aedf077..6d5d4378 100644 --- a/SW.Bitween.PgSql/Migrations/20210612111308_update2.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210612111308_update2.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -119,7 +119,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -139,7 +139,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -271,7 +271,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -367,7 +367,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -393,7 +393,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -413,7 +413,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -441,7 +441,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -516,7 +516,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -552,7 +552,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -623,7 +623,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210612111308_update2.cs b/SW.Bitween.PgSql/Migrations/20210612111308_update2.cs index a708b2a9..72b1f799 100644 --- a/SW.Bitween.PgSql/Migrations/20210612111308_update2.cs +++ b/SW.Bitween.PgSql/Migrations/20210612111308_update2.cs @@ -9,7 +9,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "notifier", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false) @@ -32,7 +32,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "notifier", - schema: "Bitween"); + schema: "infolink"); } } } diff --git a/SW.Bitween.PgSql/Migrations/20210630180119_update3.Designer.cs b/SW.Bitween.PgSql/Migrations/20210630180119_update3.Designer.cs index 892ce073..1e6dad4a 100644 --- a/SW.Bitween.PgSql/Migrations/20210630180119_update3.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210630180119_update3.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -119,7 +119,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -139,7 +139,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -271,7 +271,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -367,7 +367,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -393,7 +393,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -413,7 +413,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -453,7 +453,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -481,7 +481,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -556,7 +556,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -592,7 +592,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -663,7 +663,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210630180119_update3.cs b/SW.Bitween.PgSql/Migrations/20210630180119_update3.cs index 1e583053..f473aed3 100644 --- a/SW.Bitween.PgSql/Migrations/20210630180119_update3.cs +++ b/SW.Bitween.PgSql/Migrations/20210630180119_update3.cs @@ -10,7 +10,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "xchange_notification", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false) @@ -32,7 +32,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "xchange_notification", - schema: "Bitween"); + schema: "infolink"); } } } diff --git a/SW.Bitween.PgSql/Migrations/20210701125443_update4.Designer.cs b/SW.Bitween.PgSql/Migrations/20210701125443_update4.Designer.cs index 54b51cac..d8f226f6 100644 --- a/SW.Bitween.PgSql/Migrations/20210701125443_update4.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210701125443_update4.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -119,7 +119,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -144,7 +144,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange","Bitween"); + b.ToTable("on_hold_xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -164,7 +164,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -300,7 +300,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -396,7 +396,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -422,7 +422,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -442,7 +442,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -482,7 +482,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -510,7 +510,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -585,7 +585,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -621,7 +621,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -692,7 +692,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210701125443_update4.cs b/SW.Bitween.PgSql/Migrations/20210701125443_update4.cs index c005b8f3..333b7ed3 100644 --- a/SW.Bitween.PgSql/Migrations/20210701125443_update4.cs +++ b/SW.Bitween.PgSql/Migrations/20210701125443_update4.cs @@ -10,13 +10,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "paused_on", - schema: "Bitween", + schema: "infolink", table: "subscription", nullable: true); migrationBuilder.CreateTable( name: "on_hold_xchange", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(nullable: false) @@ -31,7 +31,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateIndex( name: "ix_on_hold_xchange_subscription_id", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange", column: "subscription_id"); } @@ -40,11 +40,11 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "on_hold_xchange", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropColumn( name: "paused_on", - schema: "Bitween", + schema: "infolink", table: "subscription"); } } diff --git a/SW.Bitween.PgSql/Migrations/20210704084741_update5.Designer.cs b/SW.Bitween.PgSql/Migrations/20210704084741_update5.Designer.cs index 7ad4c36a..c56f3f9f 100644 --- a/SW.Bitween.PgSql/Migrations/20210704084741_update5.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210704084741_update5.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -119,7 +119,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -156,7 +156,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange","Bitween"); + b.ToTable("on_hold_xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -176,7 +176,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -312,7 +312,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -408,7 +408,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -434,7 +434,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -454,7 +454,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -494,7 +494,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -522,7 +522,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -597,7 +597,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -633,7 +633,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -704,7 +704,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210704084741_update5.cs b/SW.Bitween.PgSql/Migrations/20210704084741_update5.cs index 4be862c4..c689477d 100644 --- a/SW.Bitween.PgSql/Migrations/20210704084741_update5.cs +++ b/SW.Bitween.PgSql/Migrations/20210704084741_update5.cs @@ -8,20 +8,20 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "bad_data", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "data", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange", nullable: true); migrationBuilder.AddColumn( name: "file_name", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange", nullable: true); } @@ -30,17 +30,17 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "bad_data", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange"); migrationBuilder.DropColumn( name: "data", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange"); migrationBuilder.DropColumn( name: "file_name", - schema: "Bitween", + schema: "infolink", table: "on_hold_xchange"); } } diff --git a/SW.Bitween.PgSql/Migrations/20210830182418_update6.Designer.cs b/SW.Bitween.PgSql/Migrations/20210830182418_update6.Designer.cs index 8816038d..8c86081d 100644 --- a/SW.Bitween.PgSql/Migrations/20210830182418_update6.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210830182418_update6.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -119,7 +119,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -156,7 +156,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange","Bitween"); + b.ToTable("on_hold_xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -176,7 +176,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -312,7 +312,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -412,7 +412,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -438,7 +438,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -458,7 +458,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -498,7 +498,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -526,7 +526,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -601,7 +601,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -637,7 +637,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -708,7 +708,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210830182418_update6.cs b/SW.Bitween.PgSql/Migrations/20210830182418_update6.cs index 8357dc20..fb939b70 100644 --- a/SW.Bitween.PgSql/Migrations/20210830182418_update6.cs +++ b/SW.Bitween.PgSql/Migrations/20210830182418_update6.cs @@ -8,7 +8,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "correlation_id", - schema: "Bitween", + schema: "infolink", table: "xchange", nullable: true); } @@ -17,7 +17,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "correlation_id", - schema: "Bitween", + schema: "infolink", table: "xchange"); } } diff --git a/SW.Bitween.PgSql/Migrations/20210925081545_update7.Designer.cs b/SW.Bitween.PgSql/Migrations/20210925081545_update7.Designer.cs index e664e58e..51cc8c9d 100644 --- a/SW.Bitween.PgSql/Migrations/20210925081545_update7.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20210925081545_update7.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -123,7 +123,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -160,7 +160,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange","Bitween"); + b.ToTable("on_hold_xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -180,7 +180,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -316,7 +316,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -416,7 +416,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -442,7 +442,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -462,7 +462,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -502,7 +502,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -530,7 +530,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -605,7 +605,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -641,7 +641,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -712,7 +712,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20210925081545_update7.cs b/SW.Bitween.PgSql/Migrations/20210925081545_update7.cs index c62d3efa..d7d3d6cf 100644 --- a/SW.Bitween.PgSql/Migrations/20210925081545_update7.cs +++ b/SW.Bitween.PgSql/Migrations/20210925081545_update7.cs @@ -9,7 +9,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "run_on_subscriptions", - schema: "Bitween", + schema: "infolink", table: "notifier", nullable: true); } @@ -18,7 +18,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "run_on_subscriptions", - schema: "Bitween", + schema: "infolink", table: "notifier"); } } diff --git a/SW.Bitween.PgSql/Migrations/20211108154104_update8.Designer.cs b/SW.Bitween.PgSql/Migrations/20211108154104_update8.Designer.cs index 8f1065a3..837fbfdf 100644 --- a/SW.Bitween.PgSql/Migrations/20211108154104_update8.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20211108154104_update8.Designer.cs @@ -18,7 +18,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -63,7 +63,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_document_name"); - b.ToTable("document","Bitween"); + b.ToTable("document","infolink"); b.HasData( new @@ -123,7 +123,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier","Bitween"); + b.ToTable("notifier","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -160,7 +160,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange","Bitween"); + b.ToTable("on_hold_xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -180,7 +180,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner","Bitween"); + b.ToTable("partner","infolink"); b.HasData( new @@ -320,7 +320,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasName("ix_subscription_response_subscription_id"); - b.ToTable("subscription","Bitween"); + b.ToTable("subscription","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -420,7 +420,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasName("ix_xchange_subscription_id"); - b.ToTable("xchange","Bitween"); + b.ToTable("xchange","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -446,7 +446,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation","Bitween"); + b.ToTable("xchange_aggregation","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -466,7 +466,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery","Bitween"); + b.ToTable("xchange_delivery","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -506,7 +506,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification","Bitween"); + b.ToTable("xchange_notification","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -534,7 +534,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties","Bitween"); + b.ToTable("xchange_promoted_properties","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -609,7 +609,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result","Bitween"); + b.ToTable("xchange_result","infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -645,7 +645,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential","Bitween"); + b1.ToTable("partner_api_credential","infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -716,7 +716,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_schedule"); - b1.ToTable("subscription_schedule","Bitween"); + b1.ToTable("subscription_schedule","infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20211108154104_update8.cs b/SW.Bitween.PgSql/Migrations/20211108154104_update8.cs index a3b7184b..b8f31c2b 100644 --- a/SW.Bitween.PgSql/Migrations/20211108154104_update8.cs +++ b/SW.Bitween.PgSql/Migrations/20211108154104_update8.cs @@ -8,7 +8,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "is_running", - schema: "Bitween", + schema: "infolink", table: "subscription", nullable: false, defaultValue: false); @@ -18,7 +18,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "is_running", - schema: "Bitween", + schema: "infolink", table: "subscription"); } } diff --git a/SW.Bitween.PgSql/Migrations/20220414101356_update9.Designer.cs b/SW.Bitween.PgSql/Migrations/20220414101356_update9.Designer.cs index b8c7ecff..41758412 100644 --- a/SW.Bitween.PgSql/Migrations/20220414101356_update9.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20220414101356_update9.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -94,7 +94,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -136,7 +136,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -179,7 +179,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -240,7 +240,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -278,7 +278,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -299,7 +299,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -440,7 +440,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -540,7 +540,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -566,7 +566,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -586,7 +586,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -627,7 +627,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -655,7 +655,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -730,7 +730,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -739,7 +739,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -788,7 +788,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -862,7 +862,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20220414101356_update9.cs b/SW.Bitween.PgSql/Migrations/20220414101356_update9.cs index f84716db..4a04b3d9 100644 --- a/SW.Bitween.PgSql/Migrations/20220414101356_update9.cs +++ b/SW.Bitween.PgSql/Migrations/20220414101356_update9.cs @@ -12,27 +12,27 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "fk_api_credential_partner_partner_id", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential"); migrationBuilder.DropForeignKey( name: "fk_schedule_subscription_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule"); migrationBuilder.DropPrimaryKey( name: "pk_schedule", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule"); migrationBuilder.DropPrimaryKey( name: "pk_api_credential", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential"); migrationBuilder.AlterColumn( name: "finished_on", - schema: "Bitween", + schema: "infolink", table: "xchange_result", type: "timestamp with time zone", nullable: false, @@ -41,7 +41,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "finished_on", - schema: "Bitween", + schema: "infolink", table: "xchange_notification", type: "timestamp with time zone", nullable: false, @@ -50,7 +50,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "delivered_on", - schema: "Bitween", + schema: "infolink", table: "xchange_delivery", type: "timestamp with time zone", nullable: false, @@ -59,7 +59,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "aggregated_on", - schema: "Bitween", + schema: "infolink", table: "xchange_aggregation", type: "timestamp with time zone", nullable: false, @@ -68,7 +68,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "started_on", - schema: "Bitween", + schema: "infolink", table: "xchange", type: "timestamp with time zone", nullable: false, @@ -77,7 +77,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "receive_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp with time zone", nullable: true, @@ -87,7 +87,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "paused_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp with time zone", nullable: true, @@ -97,7 +97,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "aggregate_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp with time zone", nullable: true, @@ -107,19 +107,19 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AddPrimaryKey( name: "pk_subscription_schedule", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule", columns: new[] { "subscription_id", "id" }); migrationBuilder.AddPrimaryKey( name: "pk_partner_api_credential", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", columns: new[] { "partner_id", "id" }); migrationBuilder.CreateTable( name: "Accounts", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(type: "integer", nullable: false) @@ -143,7 +143,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "running_result", - schema: "Bitween", + schema: "infolink", columns: table => new { is_running = table.Column(type: "boolean", nullable: false) @@ -154,7 +154,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "RefreshTokens", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), @@ -168,47 +168,47 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_refresh_tokens_accounts_account_id", column: x => x.account_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "Accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "Accounts", columns: new[] { "id", "created_by", "created_on", "disabled", "display_name", "email", "email_provider", "login_methods", "modified_by", "modified_on", "password", "phone" }, values: new object[] { 9999, null, new DateTime(2022, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), false, "Admin", "admin@Bitween.systems", (byte)0, (byte)2, null, null, "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", null }); migrationBuilder.CreateIndex( name: "ix_accounts_email", - schema: "Bitween", + schema: "infolink", table: "Accounts", column: "email", unique: true); migrationBuilder.CreateIndex( name: "ix_refresh_tokens_account_id", - schema: "Bitween", + schema: "infolink", table: "RefreshTokens", column: "account_id"); migrationBuilder.AddForeignKey( name: "fk_partner_api_credential_partner_partner_id", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", column: "partner_id", - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "partner", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "fk_subscription_schedule_subscription_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule", column: "subscription_id", - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -218,39 +218,39 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "fk_partner_api_credential_partner_partner_id", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential"); migrationBuilder.DropForeignKey( name: "fk_subscription_schedule_subscription_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule"); migrationBuilder.DropTable( name: "RefreshTokens", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "running_result", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "Accounts", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropPrimaryKey( name: "pk_subscription_schedule", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule"); migrationBuilder.DropPrimaryKey( name: "pk_partner_api_credential", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential"); migrationBuilder.AlterColumn( name: "finished_on", - schema: "Bitween", + schema: "infolink", table: "xchange_result", type: "timestamp without time zone", nullable: false, @@ -259,7 +259,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "finished_on", - schema: "Bitween", + schema: "infolink", table: "xchange_notification", type: "timestamp without time zone", nullable: false, @@ -268,7 +268,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "delivered_on", - schema: "Bitween", + schema: "infolink", table: "xchange_delivery", type: "timestamp without time zone", nullable: false, @@ -277,7 +277,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "aggregated_on", - schema: "Bitween", + schema: "infolink", table: "xchange_aggregation", type: "timestamp without time zone", nullable: false, @@ -286,7 +286,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "started_on", - schema: "Bitween", + schema: "infolink", table: "xchange", type: "timestamp without time zone", nullable: false, @@ -295,7 +295,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "receive_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp without time zone", nullable: true, @@ -305,7 +305,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "paused_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp without time zone", nullable: true, @@ -315,7 +315,7 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AlterColumn( name: "aggregate_on", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "timestamp without time zone", nullable: true, @@ -325,32 +325,32 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.AddPrimaryKey( name: "pk_schedule", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule", columns: new[] { "subscription_id", "id" }); migrationBuilder.AddPrimaryKey( name: "pk_api_credential", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", columns: new[] { "partner_id", "id" }); migrationBuilder.AddForeignKey( name: "fk_api_credential_partner_partner_id", - schema: "Bitween", + schema: "infolink", table: "partner_api_credential", column: "partner_id", - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "partner", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "fk_schedule_subscription_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription_schedule", column: "subscription_id", - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Cascade); diff --git a/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.Designer.cs b/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.Designer.cs index b3d7d606..cdad237d 100644 --- a/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -94,7 +94,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -136,7 +136,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -183,7 +183,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -245,7 +245,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -283,7 +283,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -304,7 +304,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -445,7 +445,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -545,7 +545,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -571,7 +571,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -591,7 +591,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -632,7 +632,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -660,7 +660,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -735,7 +735,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -744,7 +744,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -793,7 +793,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -867,7 +867,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.cs b/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.cs index 0e66299c..9b4ca7d5 100644 --- a/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.cs +++ b/SW.Bitween.PgSql/Migrations/20220816114929_XMLSupport.cs @@ -10,7 +10,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "document_format", - schema: "Bitween", + schema: "infolink", table: "document", type: "integer", nullable: false, @@ -21,7 +21,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "document_format", - schema: "Bitween", + schema: "infolink", table: "document"); } } diff --git a/SW.Bitween.PgSql/Migrations/20221221093002_update11.Designer.cs b/SW.Bitween.PgSql/Migrations/20221221093002_update11.Designer.cs index 77e730ed..9d2f8202 100644 --- a/SW.Bitween.PgSql/Migrations/20221221093002_update11.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20221221093002_update11.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -94,7 +94,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -136,7 +136,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -187,7 +187,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -249,7 +249,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -287,7 +287,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -308,7 +308,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -449,7 +449,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -549,7 +549,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -575,7 +575,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -595,7 +595,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -636,7 +636,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -664,7 +664,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -739,7 +739,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -748,7 +748,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -797,7 +797,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -871,7 +871,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20221221093002_update11.cs b/SW.Bitween.PgSql/Migrations/20221221093002_update11.cs index 5c615852..967cf921 100644 --- a/SW.Bitween.PgSql/Migrations/20221221093002_update11.cs +++ b/SW.Bitween.PgSql/Migrations/20221221093002_update11.cs @@ -10,7 +10,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "disregards_unfiltered_messages", - schema: "Bitween", + schema: "infolink", table: "document", type: "boolean", nullable: true); @@ -20,7 +20,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "disregards_unfiltered_messages", - schema: "Bitween", + schema: "infolink", table: "document"); } } diff --git a/SW.Bitween.PgSql/Migrations/20221229124737_update12.Designer.cs b/SW.Bitween.PgSql/Migrations/20221229124737_update12.Designer.cs index e065c8c2..2c362350 100644 --- a/SW.Bitween.PgSql/Migrations/20221229124737_update12.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20221229124737_update12.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -98,7 +98,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => @@ -127,7 +127,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -178,7 +178,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -240,7 +240,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -278,7 +278,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -299,7 +299,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -440,7 +440,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -540,7 +540,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -566,7 +566,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -586,7 +586,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -627,7 +627,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -655,7 +655,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -730,7 +730,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -739,7 +739,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -788,7 +788,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -862,7 +862,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20221229124737_update12.cs b/SW.Bitween.PgSql/Migrations/20221229124737_update12.cs index 9f503f7c..b31ddd0c 100644 --- a/SW.Bitween.PgSql/Migrations/20221229124737_update12.cs +++ b/SW.Bitween.PgSql/Migrations/20221229124737_update12.cs @@ -10,14 +10,14 @@ public partial class update12 : Migration protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DeleteData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999); migrationBuilder.AddColumn( name: "deleted", - schema: "Bitween", + schema: "infolink", table: "Accounts", type: "boolean", nullable: false, @@ -28,11 +28,11 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "deleted", - schema: "Bitween", + schema: "infolink", table: "Accounts"); migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "Accounts", columns: new[] { "id", "created_by", "created_on", "disabled", "display_name", "email", "email_provider", "login_methods", "modified_by", "modified_on", "password", "phone" }, values: new object[] { 9999, null, new DateTime(2022, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, "Admin", "admin@Bitween.systems", (byte)0, (byte)2, null, null, "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", null }); diff --git a/SW.Bitween.PgSql/Migrations/20221229130845_update13.Designer.cs b/SW.Bitween.PgSql/Migrations/20221229130845_update13.Designer.cs index 16c6e457..5f8bd3e2 100644 --- a/SW.Bitween.PgSql/Migrations/20221229130845_update13.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20221229130845_update13.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -98,7 +98,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -141,7 +141,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -192,7 +192,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -254,7 +254,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -292,7 +292,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -313,7 +313,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -454,7 +454,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -554,7 +554,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -580,7 +580,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -600,7 +600,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -641,7 +641,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -669,7 +669,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -744,7 +744,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -753,7 +753,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -802,7 +802,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -876,7 +876,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20221229130845_update13.cs b/SW.Bitween.PgSql/Migrations/20221229130845_update13.cs index 1e080c22..22a3674c 100644 --- a/SW.Bitween.PgSql/Migrations/20221229130845_update13.cs +++ b/SW.Bitween.PgSql/Migrations/20221229130845_update13.cs @@ -10,7 +10,7 @@ public partial class update13 : Migration protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.InsertData( - schema: "Bitween", + schema: "infolink", table: "Accounts", columns: new[] { "id", "created_by", "created_on", "deleted", "disabled", "display_name", "email", "email_provider", "login_methods", "modified_by", "modified_on", "password", "phone" }, values: new object[] { 9999, null, new DateTime(2021, 12, 31, 22, 0, 0, 0, DateTimeKind.Utc), false, false, "Admin", "admin@Bitween.systems", (byte)0, (byte)2, null, null, "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", null }); @@ -19,7 +19,7 @@ protected override void Up(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DeleteData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999); diff --git a/SW.Bitween.PgSql/Migrations/20230129072000_update14.Designer.cs b/SW.Bitween.PgSql/Migrations/20230129072000_update14.Designer.cs index 1d87a3f3..922f2b4b 100644 --- a/SW.Bitween.PgSql/Migrations/20230129072000_update14.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20230129072000_update14.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -98,7 +98,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -141,7 +141,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -192,7 +192,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -254,7 +254,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -292,7 +292,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -313,7 +313,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -458,7 +458,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -558,7 +558,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -584,7 +584,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -604,7 +604,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -645,7 +645,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -673,7 +673,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -748,7 +748,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -757,7 +757,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -806,7 +806,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -880,7 +880,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20230129072000_update14.cs b/SW.Bitween.PgSql/Migrations/20230129072000_update14.cs index 0ad4e99e..2b7f31f6 100644 --- a/SW.Bitween.PgSql/Migrations/20230129072000_update14.cs +++ b/SW.Bitween.PgSql/Migrations/20230129072000_update14.cs @@ -11,13 +11,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "match_expression", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "text", nullable: true); migrationBuilder.UpdateData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999, @@ -29,11 +29,11 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "match_expression", - schema: "Bitween", + schema: "infolink", table: "subscription"); migrationBuilder.UpdateData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999, diff --git a/SW.Bitween.PgSql/Migrations/20230207095105_update15.Designer.cs b/SW.Bitween.PgSql/Migrations/20230207095105_update15.Designer.cs index 7079eaa7..316e914d 100644 --- a/SW.Bitween.PgSql/Migrations/20230207095105_update15.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20230207095105_update15.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -98,7 +98,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -141,7 +141,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -192,7 +192,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -245,7 +245,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "Bitween"); + b.ToTable("document_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -296,7 +296,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -334,7 +334,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -355,7 +355,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -500,7 +500,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -543,7 +543,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "Bitween"); + b.ToTable("subscription_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -643,7 +643,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -669,7 +669,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -689,7 +689,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -730,7 +730,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -758,7 +758,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -833,7 +833,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -842,7 +842,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -903,7 +903,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -977,7 +977,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20230207095105_update15.cs b/SW.Bitween.PgSql/Migrations/20230207095105_update15.cs index 965bd8f3..9270e5ac 100644 --- a/SW.Bitween.PgSql/Migrations/20230207095105_update15.cs +++ b/SW.Bitween.PgSql/Migrations/20230207095105_update15.cs @@ -11,7 +11,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "document_trail", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(type: "text", nullable: false), @@ -28,7 +28,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_document_trail_document_document_id", column: x => x.document_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "document", principalColumn: "id", onDelete: ReferentialAction.Cascade); @@ -36,7 +36,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "subscription_trail", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), @@ -53,14 +53,14 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "fk_subscription_trail_subscription_subscription_id", column: x => x.subscription_id, - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999, @@ -69,25 +69,25 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateIndex( name: "ix_document_trail_created_on", - schema: "Bitween", + schema: "infolink", table: "document_trail", column: "created_on"); migrationBuilder.CreateIndex( name: "ix_document_trail_document_id", - schema: "Bitween", + schema: "infolink", table: "document_trail", column: "document_id"); migrationBuilder.CreateIndex( name: "ix_subscription_trail_created_on", - schema: "Bitween", + schema: "infolink", table: "subscription_trail", column: "created_on"); migrationBuilder.CreateIndex( name: "ix_subscription_trail_subscription_id", - schema: "Bitween", + schema: "infolink", table: "subscription_trail", column: "subscription_id"); } @@ -96,14 +96,14 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "document_trail", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropTable( name: "subscription_trail", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.UpdateData( - schema: "Bitween", + schema: "infolink", table: "Accounts", keyColumn: "id", keyValue: 9999, diff --git a/SW.Bitween.PgSql/Migrations/20230220104919_update_16.Designer.cs b/SW.Bitween.PgSql/Migrations/20230220104919_update_16.Designer.cs index 97c65dee..49f0cd88 100644 --- a/SW.Bitween.PgSql/Migrations/20230220104919_update_16.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20230220104919_update_16.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -102,7 +102,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -146,7 +146,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -197,7 +197,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -250,7 +250,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "Bitween"); + b.ToTable("document_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -301,7 +301,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -339,7 +339,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -360,7 +360,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -505,7 +505,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -548,7 +548,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "Bitween"); + b.ToTable("subscription_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -648,7 +648,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -674,7 +674,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -694,7 +694,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -735,7 +735,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -763,7 +763,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -838,7 +838,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -847,7 +847,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -908,7 +908,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -982,7 +982,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20230220104919_update_16.cs b/SW.Bitween.PgSql/Migrations/20230220104919_update_16.cs index 984501cb..baeb16de 100644 --- a/SW.Bitween.PgSql/Migrations/20230220104919_update_16.cs +++ b/SW.Bitween.PgSql/Migrations/20230220104919_update_16.cs @@ -10,7 +10,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "role", - schema: "Bitween", + schema: "infolink", table: "Accounts", type: "integer", nullable: false, @@ -21,7 +21,7 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "role", - schema: "Bitween", + schema: "infolink", table: "Accounts"); } } diff --git a/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.Designer.cs b/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.Designer.cs index 6256ca98..16207dfc 100644 --- a/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.Designer.cs @@ -20,7 +20,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") + .HasDefaultSchema("infolink") .HasAnnotation("ProductVersion", "6.0.20") .HasAnnotation("Relational:MaxIdentifierLength", 63); @@ -102,7 +102,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -146,7 +146,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -197,7 +197,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -250,7 +250,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "Bitween"); + b.ToTable("document_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -301,7 +301,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -339,7 +339,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -360,7 +360,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -512,7 +512,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => @@ -555,7 +555,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_subscription_category_code"); - b.ToTable("subscription_category", "Bitween"); + b.ToTable("subscription_category", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -598,7 +598,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "Bitween"); + b.ToTable("subscription_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -698,7 +698,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -724,7 +724,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -744,7 +744,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -785,7 +785,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -813,7 +813,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -888,7 +888,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -897,7 +897,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null); }); @@ -958,7 +958,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -1037,7 +1037,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.cs b/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.cs index 7a824350..a862c0d9 100644 --- a/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.cs +++ b/SW.Bitween.PgSql/Migrations/20230910151704_SubscriptionCategory.cs @@ -12,14 +12,14 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "category_id", - schema: "Bitween", + schema: "infolink", table: "subscription", type: "integer", nullable: true); migrationBuilder.CreateTable( name: "subscription_category", - schema: "Bitween", + schema: "infolink", columns: table => new { id = table.Column(type: "integer", nullable: false) @@ -38,23 +38,23 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateIndex( name: "ix_subscription_category_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "category_id"); migrationBuilder.CreateIndex( name: "ix_subscription_category_code", - schema: "Bitween", + schema: "infolink", table: "subscription_category", column: "code", unique: true); migrationBuilder.AddForeignKey( name: "fk_subscription_subscription_category_category_id", - schema: "Bitween", + schema: "infolink", table: "subscription", column: "category_id", - principalSchema: "Bitween", + principalSchema: "infolink", principalTable: "subscription_category", principalColumn: "id"); } @@ -63,21 +63,21 @@ protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "fk_subscription_subscription_category_category_id", - schema: "Bitween", + schema: "infolink", table: "subscription"); migrationBuilder.DropTable( name: "subscription_category", - schema: "Bitween"); + schema: "infolink"); migrationBuilder.DropIndex( name: "ix_subscription_category_id", - schema: "Bitween", + schema: "infolink", table: "subscription"); migrationBuilder.DropColumn( name: "category_id", - schema: "Bitween", + schema: "infolink", table: "subscription"); } } diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs new file mode 100644 index 00000000..7376c800 --- /dev/null +++ b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs @@ -0,0 +1,1167 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SW.Bitween.Domain; +using SW.Bitween.PgSql; + +#nullable disable + +namespace SW.Bitween.PgSql.Migrations +{ + [DbContext(typeof(BitweenDbContext))] + [Migration("20260121132821_SubscriptionWorkGroup")] + partial class SubscriptionWorkGroup + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("bitween") + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("text") + .HasColumnName("created_by"); + + b.Property("CreatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("Disabled") + .HasColumnType("boolean") + .HasColumnName("disabled"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("display_name"); + + b.Property("Email") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("character varying(200)") + .HasColumnName("email"); + + b.Property("EmailProvider") + .HasColumnType("smallint") + .HasColumnName("email_provider"); + + b.Property("LoginMethods") + .HasColumnType("smallint") + .HasColumnName("login_methods"); + + b.Property("ModifiedBy") + .HasColumnType("text") + .HasColumnName("modified_by"); + + b.Property("ModifiedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_on"); + + b.Property("Password") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("character varying(500)") + .HasColumnName("password"); + + b.Property("Phone") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)") + .HasColumnName("phone"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.HasKey("Id") + .HasName("pk_accounts"); + + b.HasIndex("Email") + .IsUnique() + .HasDatabaseName("ix_accounts_email"); + + b.ToTable("Accounts", "bitween"); + + b.HasData( + new + { + Id = 9999, + CreatedOn = new DateTime(2021, 12, 31, 22, 0, 0, 0, DateTimeKind.Utc), + Deleted = false, + Disabled = false, + DisplayName = "Admin", + Email = "admin@Bitween.systems", + EmailProvider = (byte)0, + LoginMethods = (byte)2, + Password = "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", + Role = 0 + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("AccountId") + .HasColumnType("integer") + .HasColumnName("account_id"); + + b.Property("CreatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on"); + + b.Property("LoginMethod") + .HasColumnType("smallint") + .HasColumnName("login_method"); + + b.HasKey("Id") + .HasName("pk_refresh_tokens"); + + b.HasIndex("AccountId") + .HasDatabaseName("ix_refresh_tokens_account_id"); + + b.ToTable("RefreshTokens", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Document", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("BusEnabled") + .HasColumnType("boolean") + .HasColumnName("bus_enabled"); + + b.Property("BusMessageTypeName") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("bus_message_type_name"); + + b.Property("DisregardsUnfilteredMessages") + .HasColumnType("boolean") + .HasColumnName("disregards_unfiltered_messages"); + + b.Property("DocumentFormat") + .HasColumnType("integer") + .HasColumnName("document_format"); + + b.Property("DuplicateInterval") + .HasColumnType("integer") + .HasColumnName("duplicate_interval"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("name"); + + b.Property("PromotedProperties") + .HasColumnType("jsonb") + .HasColumnName("promoted_properties"); + + b.HasKey("Id") + .HasName("pk_document"); + + b.HasIndex("BusMessageTypeName") + .IsUnique() + .HasDatabaseName("ix_document_bus_message_type_name"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("ix_document_name"); + + b.ToTable("document", "bitween"); + + b.HasData( + new + { + Id = 10001, + BusEnabled = false, + DocumentFormat = 0, + DuplicateInterval = 0, + Name = "Aggregation Document", + PromotedProperties = "{}" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.Property("Id") + .HasColumnType("text") + .HasColumnName("id"); + + b.Property("Code") + .HasColumnType("integer") + .HasColumnName("code"); + + b.Property("CreatedBy") + .HasColumnType("text") + .HasColumnName("created_by"); + + b.Property("CreatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on"); + + b.Property("DocumentId") + .HasColumnType("integer") + .HasColumnName("document_id"); + + b.Property("StateAfter") + .HasColumnType("text") + .HasColumnName("state_after"); + + b.Property("StateBefore") + .HasColumnType("text") + .HasColumnName("state_before"); + + b.HasKey("Id") + .HasName("pk_document_trail"); + + b.HasIndex("CreatedOn") + .HasDatabaseName("ix_document_trail_created_on"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_document_trail_document_id"); + + b.ToTable("document_trail", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("character varying(200)") + .HasColumnName("handler_id"); + + b.Property("HandlerProperties") + .HasColumnType("text") + .HasColumnName("handler_properties"); + + b.Property("Inactive") + .HasColumnType("boolean") + .HasColumnName("inactive"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("name"); + + b.Property("RunOnBadResult") + .HasColumnType("boolean") + .HasColumnName("run_on_bad_result"); + + b.Property("RunOnFailedResult") + .HasColumnType("boolean") + .HasColumnName("run_on_failed_result"); + + b.Property("RunOnSubscriptions") + .HasColumnType("integer[]") + .HasColumnName("run_on_subscriptions"); + + b.Property("RunOnSuccessfulResult") + .HasColumnType("boolean") + .HasColumnName("run_on_successful_result"); + + b.HasKey("Id") + .HasName("pk_notifier"); + + b.ToTable("notifier", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BadData") + .HasColumnType("boolean") + .HasColumnName("bad_data"); + + b.Property("Data") + .HasColumnType("text") + .HasColumnName("data"); + + b.Property("FileName") + .HasColumnType("text") + .HasColumnName("file_name"); + + b.Property("References") + .HasColumnType("text[]") + .HasColumnName("references"); + + b.Property("SubscriptionId") + .HasColumnType("integer") + .HasColumnName("subscription_id"); + + b.HasKey("Id") + .HasName("pk_on_hold_xchange"); + + b.HasIndex("SubscriptionId") + .HasDatabaseName("ix_on_hold_xchange_subscription_id"); + + b.ToTable("on_hold_xchange", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("name"); + + b.HasKey("Id") + .HasName("pk_partner"); + + b.ToTable("partner", "bitween"); + + b.HasData( + new + { + Id = 1, + Name = "SYSTEM" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AggregateOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("aggregate_on"); + + b.Property("AggregationForId") + .HasColumnType("integer") + .HasColumnName("aggregation_for_id"); + + b.Property("AggregationTarget") + .HasColumnType("smallint") + .HasColumnName("aggregation_target"); + + b.Property("CategoryId") + .HasColumnType("integer") + .HasColumnName("category_id"); + + b.Property("ConsecutiveFailures") + .HasColumnType("integer") + .HasColumnName("consecutive_failures"); + + b.Property>("DocumentFilter") + .HasColumnType("jsonb") + .HasColumnName("document_filter"); + + b.Property("DocumentId") + .HasColumnType("integer") + .HasColumnName("document_id"); + + b.Property("HandlerId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("handler_id"); + + b.Property>("HandlerProperties") + .HasColumnType("jsonb") + .HasColumnName("handler_properties"); + + b.Property("Inactive") + .HasColumnType("boolean") + .HasColumnName("inactive"); + + b.Property("IsRunning") + .HasColumnType("boolean") + .HasColumnName("is_running"); + + b.Property("LastException") + .HasColumnType("text") + .HasColumnName("last_exception"); + + b.Property("MapperId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("mapper_id"); + + b.Property>("MapperProperties") + .HasColumnType("jsonb") + .HasColumnName("mapper_properties"); + + b.Property("MatchExpression") + .HasColumnType("text") + .HasColumnName("match_expression"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("name"); + + b.Property("PartnerId") + .HasColumnType("integer") + .HasColumnName("partner_id"); + + b.Property("PausedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("paused_on"); + + b.Property("ReceiveOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("receive_on"); + + b.Property("ReceiverId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("receiver_id"); + + b.Property>("ReceiverProperties") + .HasColumnType("jsonb") + .HasColumnName("receiver_properties"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("response_message_type_name"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("integer") + .HasColumnName("response_subscription_id"); + + b.Property("Temporary") + .HasColumnType("boolean") + .HasColumnName("temporary"); + + b.Property("Type") + .HasColumnType("smallint") + .HasColumnName("type"); + + b.Property("ValidatorId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("validator_id"); + + b.Property>("ValidatorProperties") + .HasColumnType("jsonb") + .HasColumnName("validator_properties"); + + b.Property("WorkGroupId") + .HasColumnType("integer") + .HasColumnName("work_group_id"); + + b.HasKey("Id") + .HasName("pk_subscription"); + + b.HasIndex("AggregationForId") + .HasDatabaseName("ix_subscription_aggregation_for_id"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_subscription_category_id"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_subscription_document_id"); + + b.HasIndex("PartnerId") + .HasDatabaseName("ix_subscription_partner_id"); + + b.HasIndex("ResponseSubscriptionId") + .HasDatabaseName("ix_subscription_response_subscription_id"); + + b.HasIndex("WorkGroupId") + .HasDatabaseName("ix_subscription_work_group_id"); + + b.ToTable("subscription", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .HasColumnType("text") + .HasColumnName("code"); + + b.Property("CreatedBy") + .HasColumnType("text") + .HasColumnName("created_by"); + + b.Property("CreatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedBy") + .HasColumnType("text") + .HasColumnName("modified_by"); + + b.Property("ModifiedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_on"); + + b.HasKey("Id") + .HasName("pk_subscription_category"); + + b.HasIndex("Code") + .IsUnique() + .HasDatabaseName("ix_subscription_category_code"); + + b.ToTable("subscription_category", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("Code") + .HasColumnType("integer") + .HasColumnName("code"); + + b.Property("CreatedBy") + .HasColumnType("text") + .HasColumnName("created_by"); + + b.Property("CreatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on"); + + b.Property("StateAfter") + .HasColumnType("text") + .HasColumnName("state_after"); + + b.Property("StateBefore") + .HasColumnType("text") + .HasColumnName("state_before"); + + b.Property("SubscriptionId") + .HasColumnType("integer") + .HasColumnName("subscription_id"); + + b.HasKey("Id") + .HasName("pk_subscription_trail"); + + b.HasIndex("CreatedOn") + .HasDatabaseName("ix_subscription_trail_created_on"); + + b.HasIndex("SubscriptionId") + .HasDatabaseName("ix_subscription_trail_subscription_id"); + + b.ToTable("subscription_trail", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("character varying(100)") + .HasColumnName("bus_message_name"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Options") + .HasColumnType("jsonb") + .HasColumnName("options"); + + b.HasKey("Id") + .HasName("pk_work_group"); + + b.ToTable("work_group", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("CorrelationId") + .HasColumnType("text") + .HasColumnName("correlation_id"); + + b.Property("DocumentId") + .HasColumnType("integer") + .HasColumnName("document_id"); + + b.Property("HandlerId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("handler_id"); + + b.Property>("HandlerProperties") + .HasColumnType("jsonb") + .HasColumnName("handler_properties"); + + b.Property("InputContentType") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("input_content_type"); + + b.Property("InputHash") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("input_hash"); + + b.Property("InputName") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("input_name"); + + b.Property("InputSize") + .HasColumnType("integer") + .HasColumnName("input_size"); + + b.Property("MapperId") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("mapper_id"); + + b.Property>("MapperProperties") + .HasColumnType("jsonb") + .HasColumnName("mapper_properties"); + + b.Property("References") + .HasColumnType("text[]") + .HasColumnName("references"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("response_message_type_name"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("integer") + .HasColumnName("response_subscription_id"); + + b.Property("RetryFor") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("retry_for"); + + b.Property("StartedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("started_on"); + + b.Property("SubscriptionId") + .HasColumnType("integer") + .HasColumnName("subscription_id"); + + b.HasKey("Id") + .HasName("pk_xchange"); + + b.HasIndex("DocumentId") + .HasDatabaseName("ix_xchange_document_id"); + + b.HasIndex("InputHash") + .HasDatabaseName("ix_xchange_input_hash"); + + b.HasIndex("RetryFor") + .HasDatabaseName("ix_xchange_retry_for"); + + b.HasIndex("StartedOn") + .HasDatabaseName("ix_xchange_started_on"); + + b.HasIndex("SubscriptionId") + .HasDatabaseName("ix_xchange_subscription_id"); + + b.ToTable("xchange", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("AggregatedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("aggregated_on"); + + b.Property("AggregationXchangeId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("aggregation_xchange_id"); + + b.HasKey("Id") + .HasName("pk_xchange_aggregation"); + + b.HasIndex("AggregationXchangeId") + .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); + + b.ToTable("xchange_aggregation", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("DeliveredOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("delivered_on"); + + b.HasKey("Id") + .HasName("pk_xchange_delivery"); + + b.HasIndex("DeliveredOn") + .HasDatabaseName("ix_xchange_delivery_delivered_on"); + + b.ToTable("xchange_delivery", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Exception") + .HasColumnType("text") + .HasColumnName("exception"); + + b.Property("FinishedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("finished_on"); + + b.Property("NotifierId") + .HasColumnType("integer") + .HasColumnName("notifier_id"); + + b.Property("NotifierName") + .HasColumnType("text") + .HasColumnName("notifier_name"); + + b.Property("Success") + .HasColumnType("boolean") + .HasColumnName("success"); + + b.Property("XchangeId") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)") + .HasColumnName("xchange_id"); + + b.HasKey("Id") + .HasName("pk_xchange_notification"); + + b.ToTable("xchange_notification", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("Hits") + .HasColumnType("integer[]") + .HasColumnName("hits"); + + b.Property>("Properties") + .HasColumnType("jsonb") + .HasColumnName("properties"); + + b.Property("PropertiesRaw") + .HasColumnType("text") + .HasColumnName("properties_raw"); + + b.HasKey("Id") + .HasName("pk_xchange_promoted_properties"); + + b.HasIndex("PropertiesRaw") + .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); + + b.ToTable("xchange_promoted_properties", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("Exception") + .HasColumnType("text") + .HasColumnName("exception"); + + b.Property("FinishedOn") + .HasColumnType("timestamp with time zone") + .HasColumnName("finished_on"); + + b.Property("OutputBad") + .HasColumnType("boolean") + .HasColumnName("output_bad"); + + b.Property("OutputContentType") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("output_content_type"); + + b.Property("OutputHash") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("output_hash"); + + b.Property("OutputName") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("output_name"); + + b.Property("OutputSize") + .HasColumnType("integer") + .HasColumnName("output_size"); + + b.Property("ResponseBad") + .HasColumnType("boolean") + .HasColumnName("response_bad"); + + b.Property("ResponseContentType") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("response_content_type"); + + b.Property("ResponseHash") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("response_hash"); + + b.Property("ResponseName") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("response_name"); + + b.Property("ResponseSize") + .HasColumnType("integer") + .HasColumnName("response_size"); + + b.Property("ResponseXchangeId") + .HasColumnType("text") + .HasColumnName("response_xchange_id"); + + b.Property("Success") + .HasColumnType("boolean") + .HasColumnName("success"); + + b.HasKey("Id") + .HasName("pk_xchange_result"); + + b.ToTable("xchange_result", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => + { + b.Property("IsRunning") + .HasColumnType("boolean") + .HasColumnName("is_running"); + + b.ToTable("running_result", "bitween"); + + b.ToView(null, (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.HasOne("SW.Bitween.Domain.Accounts.Account", null) + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_refresh_tokens_accounts_account_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.HasOne("SW.Bitween.Domain.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_document_trail_document_document_id"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.OwnsMany("SW.Bitween.Domain.ApiCredential", "ApiCredentials", b1 => + { + b1.Property("PartnerId") + .HasColumnType("integer") + .HasColumnName("partner_id"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Key") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("key"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("name"); + + b1.HasKey("PartnerId", "Id") + .HasName("pk_partner_api_credential"); + + b1.HasIndex("Key") + .IsUnique() + .HasDatabaseName("ix_partner_api_credential_key"); + + b1.ToTable("partner_api_credential", "bitween"); + + b1.WithOwner() + .HasForeignKey("PartnerId") + .HasConstraintName("fk_partner_api_credential_partner_partner_id"); + + b1.HasData( + new + { + PartnerId = 1, + Id = 1, + Key = "7facc758283844b49cc4ffd26a75b1de", + Name = "default" + }); + }); + + b.Navigation("ApiCredentials"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("AggregationForId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("fk_subscription_aggregation_for"); + + b.HasOne("SW.Bitween.Domain.SubscriptionCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .HasConstraintName("fk_subscription_subscription_category_category_id"); + + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_subscription_document_document_id"); + + b.HasOne("SW.Bitween.Domain.Partner", null) + .WithMany("Subscriptions") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("fk_subscription_partner_partner_id"); + + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("ResponseSubscriptionId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("fk_subscription_response_subscriber"); + + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId") + .HasConstraintName("fk_subscription_work_group_work_group_id"); + + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => + { + b1.Property("SubscriptionId") + .HasColumnType("integer") + .HasColumnName("subscription_id"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Backwards") + .HasColumnType("boolean") + .HasColumnName("backwards"); + + b1.Property("On") + .HasColumnType("bigint") + .HasColumnName("on"); + + b1.Property("Recurrence") + .HasColumnType("smallint") + .HasColumnName("recurrence"); + + b1.HasKey("SubscriptionId", "Id") + .HasName("pk_subscription_schedule"); + + b1.ToTable("subscription_schedule", "bitween"); + + b1.WithOwner() + .HasForeignKey("SubscriptionId") + .HasConstraintName("fk_subscription_schedule_subscription_subscription_id"); + }); + + b.Navigation("Category"); + + b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", "Subscription") + .WithMany() + .HasForeignKey("SubscriptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_subscription_trail_subscription_subscription_id"); + + b.Navigation("Subscription"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("fk_xchange_document_document_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeAggregation", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_xchange_aggregation_xchange_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeDelivery", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_xchange_delivery_xchange_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangePromotedProperties", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_xchange_promoted_properties_xchange_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeResult", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_xchange_result_xchange_id"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Navigation("Subscriptions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs new file mode 100644 index 00000000..9f4a9fa3 --- /dev/null +++ b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs @@ -0,0 +1,488 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SW.Bitween.Domain; + +#nullable disable + +namespace SW.Bitween.PgSql.Migrations +{ + public partial class SubscriptionWorkGroup : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + // 1️⃣ Rename schema (atomic & safe in PostgreSQL) + migrationBuilder.Sql(""" + ALTER SCHEMA infolink RENAME TO bitween; + """); + + // 2️⃣ Add column + migrationBuilder.AddColumn( + name: "work_group_id", + schema: "bitween", + table: "subscription", + type: "integer", + nullable: true); + + // 3️⃣ Create new table + migrationBuilder.CreateTable( + name: "work_group", + schema: "bitween", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", + NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "text", nullable: true), + bus_message_name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + options = table.Column(type: "jsonb", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_work_group", x => x.id); + }); + + // 4️⃣ Index + FK + migrationBuilder.CreateIndex( + name: "ix_subscription_work_group_id", + schema: "bitween", + table: "subscription", + column: "work_group_id"); + + migrationBuilder.AddForeignKey( + name: "fk_subscription_work_group_work_group_id", + schema: "bitween", + table: "subscription", + column: "work_group_id", + principalSchema: "bitween", + principalTable: "work_group", + principalColumn: "id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "work_group", + schema: "bitween"); + + migrationBuilder.DropIndex( + name: "ix_subscription_work_group_id", + schema: "bitween", + table: "subscription"); + + migrationBuilder.DropColumn( + name: "work_group_id", + schema: "bitween", + table: "subscription"); + + migrationBuilder.Sql(""" + ALTER SCHEMA bitween RENAME TO infolink; + """); + } +} + + /// + public partial class SubscriptionWoqrkGroup : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_xchange_aggregation_xchange_xchange_id", + schema: "infolink", + table: "xchange_aggregation"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_delivery_xchange_xchange_id", + schema: "infolink", + table: "xchange_delivery"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_promoted_properties_xchange_xchange_id", + schema: "infolink", + table: "xchange_promoted_properties"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_result_xchange_xchange_id", + schema: "infolink", + table: "xchange_result"); + + migrationBuilder.EnsureSchema( + name: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange_result", + schema: "infolink", + newName: "xchange_result", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange_promoted_properties", + schema: "infolink", + newName: "xchange_promoted_properties", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange_notification", + schema: "infolink", + newName: "xchange_notification", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange_delivery", + schema: "infolink", + newName: "xchange_delivery", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange_aggregation", + schema: "infolink", + newName: "xchange_aggregation", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "xchange", + schema: "infolink", + newName: "xchange", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "subscription_trail", + schema: "infolink", + newName: "subscription_trail", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "subscription_schedule", + schema: "infolink", + newName: "subscription_schedule", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "subscription_category", + schema: "infolink", + newName: "subscription_category", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "subscription", + schema: "infolink", + newName: "subscription", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "running_result", + schema: "infolink", + newName: "running_result", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "RefreshTokens", + schema: "infolink", + newName: "RefreshTokens", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "partner_api_credential", + schema: "infolink", + newName: "partner_api_credential", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "partner", + schema: "infolink", + newName: "partner", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "on_hold_xchange", + schema: "infolink", + newName: "on_hold_xchange", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "notifier", + schema: "infolink", + newName: "notifier", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "document_trail", + schema: "infolink", + newName: "document_trail", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "document", + schema: "infolink", + newName: "document", + newSchema: "bitween"); + + migrationBuilder.RenameTable( + name: "Accounts", + schema: "infolink", + newName: "Accounts", + newSchema: "bitween"); + + migrationBuilder.AddColumn( + name: "work_group_id", + schema: "bitween", + table: "subscription", + type: "integer", + nullable: true); + + migrationBuilder.CreateTable( + name: "work_group", + schema: "bitween", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "text", nullable: true), + bus_message_name = table.Column(type: "character varying(100)", unicode: false, maxLength: 100, nullable: false), + options = table.Column(type: "jsonb", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_work_group", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "ix_subscription_work_group_id", + schema: "bitween", + table: "subscription", + column: "work_group_id"); + + migrationBuilder.AddForeignKey( + name: "fk_subscription_work_group_work_group_id", + schema: "bitween", + table: "subscription", + column: "work_group_id", + principalSchema: "bitween", + principalTable: "work_group", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_aggregation_xchange_id", + schema: "bitween", + table: "xchange_aggregation", + column: "id", + principalSchema: "bitween", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_delivery_xchange_id", + schema: "bitween", + table: "xchange_delivery", + column: "id", + principalSchema: "bitween", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_promoted_properties_xchange_id", + schema: "bitween", + table: "xchange_promoted_properties", + column: "id", + principalSchema: "bitween", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_result_xchange_id", + schema: "bitween", + table: "xchange_result", + column: "id", + principalSchema: "bitween", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_subscription_work_group_work_group_id", + schema: "bitween", + table: "subscription"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_aggregation_xchange_id", + schema: "bitween", + table: "xchange_aggregation"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_delivery_xchange_id", + schema: "bitween", + table: "xchange_delivery"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_promoted_properties_xchange_id", + schema: "bitween", + table: "xchange_promoted_properties"); + + migrationBuilder.DropForeignKey( + name: "fk_xchange_result_xchange_id", + schema: "bitween", + table: "xchange_result"); + + migrationBuilder.RenameTable( + name: "xchange_result", + schema: "bitween", + newName: "xchange_result", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "xchange_promoted_properties", + schema: "bitween", + newName: "xchange_promoted_properties", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "xchange_notification", + schema: "bitween", + newName: "xchange_notification", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "xchange_delivery", + schema: "bitween", + newName: "xchange_delivery", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "xchange_aggregation", + schema: "bitween", + newName: "xchange_aggregation", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "xchange", + schema: "bitween", + newName: "xchange", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "subscription_trail", + schema: "bitween", + newName: "subscription_trail", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "subscription_schedule", + schema: "bitween", + newName: "subscription_schedule", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "subscription_category", + schema: "bitween", + newName: "subscription_category", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "subscription", + schema: "bitween", + newName: "subscription", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "running_result", + schema: "bitween", + newName: "running_result", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "RefreshTokens", + schema: "bitween", + newName: "RefreshTokens", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "partner_api_credential", + schema: "bitween", + newName: "partner_api_credential", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "partner", + schema: "bitween", + newName: "partner", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "on_hold_xchange", + schema: "bitween", + newName: "on_hold_xchange", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "notifier", + schema: "bitween", + newName: "notifier", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "document_trail", + schema: "bitween", + newName: "document_trail", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "document", + schema: "bitween", + newName: "document", + newSchema: "infolink"); + + migrationBuilder.RenameTable( + name: "Accounts", + schema: "bitween", + newName: "Accounts", + newSchema: "infolink"); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_aggregation_xchange_xchange_id", + schema: "infolink", + table: "xchange_aggregation", + column: "id", + principalSchema: "infolink", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_delivery_xchange_xchange_id", + schema: "infolink", + table: "xchange_delivery", + column: "id", + principalSchema: "infolink", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_promoted_properties_xchange_xchange_id", + schema: "infolink", + table: "xchange_promoted_properties", + column: "id", + principalSchema: "infolink", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_xchange_result_xchange_xchange_id", + schema: "infolink", + table: "xchange_result", + column: "id", + principalSchema: "infolink", + principalTable: "xchange", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/SW.Bitween.PgSql/Migrations/InfolinkDbContextModelSnapshot.cs b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs similarity index 93% rename from SW.Bitween.PgSql/Migrations/InfolinkDbContextModelSnapshot.cs rename to SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs index d2913962..796dd665 100644 --- a/SW.Bitween.PgSql/Migrations/InfolinkDbContextModelSnapshot.cs +++ b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SW.Bitween.Domain; using SW.Bitween.PgSql; #nullable disable @@ -18,8 +19,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("Bitween") - .HasAnnotation("ProductVersion", "6.0.20") + .HasDefaultSchema("bitween") + .HasAnnotation("ProductVersion", "8.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -100,7 +101,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "Bitween"); + b.ToTable("Accounts", "bitween"); b.HasData( new @@ -144,7 +145,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "Bitween"); + b.ToTable("RefreshTokens", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -195,7 +196,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "Bitween"); + b.ToTable("document", "bitween"); b.HasData( new @@ -248,7 +249,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "Bitween"); + b.ToTable("document_trail", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -299,7 +300,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "Bitween"); + b.ToTable("notifier", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -337,7 +338,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "Bitween"); + b.ToTable("on_hold_xchange", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -358,7 +359,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "Bitween"); + b.ToTable("partner", "bitween"); b.HasData( new @@ -492,6 +493,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("jsonb") .HasColumnName("validator_properties"); + b.Property("WorkGroupId") + .HasColumnType("integer") + .HasColumnName("work_group_id"); + b.HasKey("Id") .HasName("pk_subscription"); @@ -510,7 +515,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ResponseSubscriptionId") .HasDatabaseName("ix_subscription_response_subscription_id"); - b.ToTable("subscription", "Bitween"); + b.HasIndex("WorkGroupId") + .HasDatabaseName("ix_subscription_work_group_id"); + + b.ToTable("subscription", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => @@ -553,7 +561,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_subscription_category_code"); - b.ToTable("subscription_category", "Bitween"); + b.ToTable("subscription_category", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -596,7 +604,37 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "Bitween"); + b.ToTable("subscription_trail", "bitween"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("character varying(100)") + .HasColumnName("bus_message_name"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Options") + .HasColumnType("jsonb") + .HasColumnName("options"); + + b.HasKey("Id") + .HasName("pk_work_group"); + + b.ToTable("work_group", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -696,7 +734,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "Bitween"); + b.ToTable("xchange", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -722,7 +760,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "Bitween"); + b.ToTable("xchange_aggregation", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -742,7 +780,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "Bitween"); + b.ToTable("xchange_delivery", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -783,7 +821,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "Bitween"); + b.ToTable("xchange_notification", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -811,7 +849,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "Bitween"); + b.ToTable("xchange_promoted_properties", "bitween"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -886,7 +924,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "Bitween"); + b.ToTable("xchange_result", "bitween"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -895,9 +933,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "Bitween"); + b.ToTable("running_result", "bitween"); - b.ToView(null); + b.ToView(null, (string)null); }); modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => @@ -956,7 +994,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "Bitween"); + b1.ToTable("partner_api_credential", "bitween"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -1007,6 +1045,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("fk_subscription_response_subscriber"); + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId") + .HasConstraintName("fk_subscription_work_group_work_group_id"); + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => { b1.Property("SubscriptionId") @@ -1035,7 +1078,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "Bitween"); + b1.ToTable("subscription_schedule", "bitween"); b1.WithOwner() .HasForeignKey("SubscriptionId") @@ -1045,6 +1088,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Category"); b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -1076,7 +1121,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("SW.Bitween.Domain.XchangeAggregation", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired() - .HasConstraintName("fk_xchange_aggregation_xchange_xchange_id"); + .HasConstraintName("fk_xchange_aggregation_xchange_id"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -1086,7 +1131,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("SW.Bitween.Domain.XchangeDelivery", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired() - .HasConstraintName("fk_xchange_delivery_xchange_xchange_id"); + .HasConstraintName("fk_xchange_delivery_xchange_id"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -1096,7 +1141,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("SW.Bitween.Domain.XchangePromotedProperties", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired() - .HasConstraintName("fk_xchange_promoted_properties_xchange_xchange_id"); + .HasConstraintName("fk_xchange_promoted_properties_xchange_id"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -1106,7 +1151,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("SW.Bitween.Domain.XchangeResult", "Id") .OnDelete(DeleteBehavior.Cascade) .IsRequired() - .HasConstraintName("fk_xchange_result_xchange_xchange_id"); + .HasConstraintName("fk_xchange_result_xchange_id"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => diff --git a/SW.Bitween.Web/Startup.cs b/SW.Bitween.Web/Startup.cs index 828b3ab2..186659d5 100644 --- a/SW.Bitween.Web/Startup.cs +++ b/SW.Bitween.Web/Startup.cs @@ -59,7 +59,7 @@ public void ConfigureServices(IServiceCollection services) services.AddBus(config => { - config.ApplicationName = "bitween"; + config.ApplicationName = bitweenOptions.QueuePrefix; config.DefaultQueuePrefetch = bitweenOptions.BusDefaultQueuePrefetch!.Value; config.AddQueueOption("XchangeService.ApiXchangeCreatedEvent", priority: 10); }); From 4a32829af5c4af4163df6db9775250c2969965fc Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Wed, 21 Jan 2026 20:08:10 +0300 Subject: [PATCH 5/8] Add WorkGroupId to Subscriptions and create WorkGroup table in MySql migration --- ...21165119_SubscriptionWorkGroup.Designer.cs | 981 ++++++++++++++++++ .../20260121165119_SubscriptionWorkGroup.cs | 72 ++ 2 files changed, 1053 insertions(+) create mode 100644 SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.Designer.cs create mode 100644 SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.cs diff --git a/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.Designer.cs b/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.Designer.cs new file mode 100644 index 00000000..628703fc --- /dev/null +++ b/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.Designer.cs @@ -0,0 +1,981 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SW.Bitween; + +#nullable disable + +namespace SW.Bitween.MySql.Migrations +{ + [DbContext(typeof(BitweenDbContext))] + [Migration("20260121165119_SubscriptionWorkGroup")] + partial class SubscriptionWorkGroup + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("Deleted") + .HasColumnType("tinyint(1)"); + + b.Property("Disabled") + .HasColumnType("tinyint(1)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Email") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("EmailProvider") + .HasColumnType("tinyint unsigned"); + + b.Property("LoginMethods") + .HasColumnType("tinyint unsigned"); + + b.Property("ModifiedBy") + .HasColumnType("longtext"); + + b.Property("ModifiedOn") + .HasColumnType("datetime(6)"); + + b.Property("Password") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("Phone") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("varchar(20)"); + + b.Property("Role") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.ToTable("Accounts", (string)null); + + b.HasData( + new + { + Id = 9999, + CreatedOn = new DateTime(2021, 12, 31, 22, 0, 0, 0, DateTimeKind.Utc), + Deleted = false, + Disabled = false, + DisplayName = "Admin", + Email = "admin@Bitween.systems", + EmailProvider = (byte)0, + LoginMethods = (byte)2, + Password = "$SWHASH$V1$10000$VQCi48eitH4Ml5juvBMOFZrMdQwBbhuIQVXe6RR7qJdDF2bJ", + Role = 0 + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("AccountId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("LoginMethod") + .HasColumnType("tinyint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("RefreshTokens", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Document", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BusEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("BusMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("DisregardsUnfilteredMessages") + .HasColumnType("tinyint(1)"); + + b.Property("DocumentFormat") + .HasColumnType("int"); + + b.Property("DuplicateInterval") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("PromotedProperties") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("BusMessageTypeName") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Documents", (string)null); + + b.HasData( + new + { + Id = 10001, + BusEnabled = false, + DocumentFormat = 0, + DuplicateInterval = 0, + Name = "Aggregation Document", + PromotedProperties = "{}" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("StateAfter") + .HasColumnType("longtext"); + + b.Property("StateBefore") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("DocumentId"); + + b.ToTable("DocumentTrail"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("longtext"); + + b.Property("Inactive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("RunOnBadResult") + .HasColumnType("tinyint(1)"); + + b.Property("RunOnFailedResult") + .HasColumnType("tinyint(1)"); + + b.Property("RunOnSubscriptions") + .HasColumnType("longtext"); + + b.Property("RunOnSuccessfulResult") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("Notifiers", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BadData") + .HasColumnType("tinyint(1)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("FileName") + .HasColumnType("longtext"); + + b.Property("References") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("OnHoldXchanges", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Partners", (string)null); + + b.HasData( + new + { + Id = 1, + Name = "SYSTEM" + }); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AggregateOn") + .HasColumnType("datetime(6)"); + + b.Property("AggregationForId") + .HasColumnType("int"); + + b.Property("AggregationTarget") + .HasColumnType("tinyint unsigned"); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ConsecutiveFailures") + .HasColumnType("int"); + + b.Property("DocumentFilter") + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("longtext"); + + b.Property("Inactive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRunning") + .HasColumnType("tinyint(1)"); + + b.Property("LastException") + .HasColumnType("longtext"); + + b.Property("MapperId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("MapperProperties") + .HasColumnType("longtext"); + + b.Property("MatchExpression") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("PartnerId") + .HasColumnType("int"); + + b.Property("PausedOn") + .HasColumnType("datetime(6)"); + + b.Property("ReceiveOn") + .HasColumnType("datetime(6)"); + + b.Property("ReceiverId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ReceiverProperties") + .HasColumnType("longtext"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("int"); + + b.Property("Temporary") + .HasColumnType("tinyint(1)"); + + b.Property("Type") + .HasColumnType("tinyint unsigned"); + + b.Property("ValidatorId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ValidatorProperties") + .HasColumnType("longtext"); + + b.Property("WorkGroupId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AggregationForId"); + + b.HasIndex("CategoryId"); + + b.HasIndex("DocumentId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("ResponseSubscriptionId"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("Subscriptions", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Code") + .HasColumnType("varchar(255)"); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ModifiedBy") + .HasColumnType("longtext"); + + b.Property("ModifiedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("Code") + .IsUnique(); + + b.ToTable("SubscriptionCategory"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("CreatedOn") + .HasColumnType("datetime(6)"); + + b.Property("StateAfter") + .HasColumnType("longtext"); + + b.Property("StateBefore") + .HasColumnType("longtext"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("SubscriptionTrail"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BusMessageName") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnType("varchar(100)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("Options") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("WorkGroup"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("CorrelationId") + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("int"); + + b.Property("HandlerId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("HandlerProperties") + .HasColumnType("longtext"); + + b.Property("InputContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("InputHash") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("InputName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("InputSize") + .HasColumnType("int"); + + b.Property("MapperId") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("MapperProperties") + .HasColumnType("longtext"); + + b.Property("References") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ResponseMessageTypeName") + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b.Property("ResponseSubscriptionId") + .HasColumnType("int"); + + b.Property("RetryFor") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("StartedOn") + .HasColumnType("datetime(6)"); + + b.Property("SubscriptionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InputHash"); + + b.HasIndex("RetryFor"); + + b.HasIndex("StartedOn"); + + b.HasIndex("SubscriptionId"); + + b.ToTable("Xchanges", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("AggregatedOn") + .HasColumnType("datetime(6)"); + + b.Property("AggregationXchangeId") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("AggregationXchangeId"); + + b.ToTable("XchangeAggregations", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("DeliveredOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("DeliveredOn"); + + b.ToTable("XchangeDeliveries", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Exception") + .HasColumnType("longtext"); + + b.Property("FinishedOn") + .HasColumnType("datetime(6)"); + + b.Property("NotifierId") + .HasColumnType("int"); + + b.Property("NotifierName") + .HasColumnType("longtext"); + + b.Property("Success") + .HasColumnType("tinyint(1)"); + + b.Property("XchangeId") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.ToTable("XchangeNotifications", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("Hits") + .HasMaxLength(2000) + .IsUnicode(false) + .HasColumnType("varchar(2000)"); + + b.Property("Properties") + .HasColumnType("longtext"); + + b.Property("PropertiesRaw") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PropertiesRaw"); + + b.ToTable("XchangePromotedProperties", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.Property("Id") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("Exception") + .HasColumnType("longtext"); + + b.Property("FinishedOn") + .HasColumnType("datetime(6)"); + + b.Property("OutputBad") + .HasColumnType("tinyint(1)"); + + b.Property("OutputContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("OutputHash") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("OutputName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("OutputSize") + .HasColumnType("int"); + + b.Property("ResponseBad") + .HasColumnType("tinyint(1)"); + + b.Property("ResponseContentType") + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnType("varchar(200)"); + + b.Property("ResponseHash") + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("varchar(50)"); + + b.Property("ResponseName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ResponseSize") + .HasColumnType("int"); + + b.Property("ResponseXchangeId") + .HasColumnType("longtext"); + + b.Property("Success") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("XchangeResults", (string)null); + }); + + modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => + { + b.Property("IsRunning") + .HasColumnType("tinyint(1)"); + + b.ToTable((string)null); + + b.ToView(null, (string)null); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Accounts.RefreshToken", b => + { + b.HasOne("SW.Bitween.Domain.Accounts.Account", null) + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.DocumentTrail", b => + { + b.HasOne("SW.Bitween.Domain.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.OwnsMany("SW.Bitween.Domain.ApiCredential", "ApiCredentials", b1 => + { + b1.Property("PartnerId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b1.Property("Id")); + + b1.Property("Key") + .IsRequired() + .HasMaxLength(500) + .IsUnicode(false) + .HasColumnType("varchar(500)"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b1.HasKey("PartnerId", "Id"); + + b1.HasIndex("Key") + .IsUnique(); + + b1.ToTable("PartnerApiCredentials", (string)null); + + b1.WithOwner() + .HasForeignKey("PartnerId"); + + b1.HasData( + new + { + PartnerId = 1, + Id = 1, + Key = "7facc758283844b49cc4ffd26a75b1de", + Name = "default" + }); + }); + + b.Navigation("ApiCredentials"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Subscription", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("AggregationForId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_Subscriptions_AggFor"); + + b.HasOne("SW.Bitween.Domain.SubscriptionCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("SW.Bitween.Domain.Partner", null) + .WithMany("Subscriptions") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("SW.Bitween.Domain.Subscription", null) + .WithMany() + .HasForeignKey("ResponseSubscriptionId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_Subscriptions_RespSub"); + + b.HasOne("SW.Bitween.Domain.WorkGroup", "WorkGroup") + .WithMany() + .HasForeignKey("WorkGroupId"); + + b.OwnsMany("SW.Bitween.Domain.Schedule", "Schedules", b1 => + { + b1.Property("SubscriptionId") + .HasColumnType("int"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b1.Property("Id")); + + b1.Property("Backwards") + .HasColumnType("tinyint(1)"); + + b1.Property("On") + .HasColumnType("bigint"); + + b1.Property("Recurrence") + .HasColumnType("tinyint unsigned"); + + b1.HasKey("SubscriptionId", "Id"); + + b1.ToTable("SubscriptionSchedules", (string)null); + + b1.WithOwner() + .HasForeignKey("SubscriptionId"); + }); + + b.Navigation("Category"); + + b.Navigation("Schedules"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => + { + b.HasOne("SW.Bitween.Domain.Subscription", "Subscription") + .WithMany() + .HasForeignKey("SubscriptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subscription"); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => + { + b.HasOne("SW.Bitween.Domain.Document", null) + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeAggregation", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeDelivery", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangePromotedProperties", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => + { + b.HasOne("SW.Bitween.Domain.Xchange", null) + .WithOne() + .HasForeignKey("SW.Bitween.Domain.XchangeResult", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("SW.Bitween.Domain.Partner", b => + { + b.Navigation("Subscriptions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.cs b/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.cs new file mode 100644 index 00000000..2e962574 --- /dev/null +++ b/SW.Bitween.MySql/Migrations/20260121165119_SubscriptionWorkGroup.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SW.Bitween.MySql.Migrations +{ + /// + public partial class SubscriptionWorkGroup : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "WorkGroupId", + table: "Subscriptions", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "WorkGroup", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + BusMessageName = table.Column(type: "varchar(100)", unicode: false, maxLength: 100, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Options = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_WorkGroup", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Subscriptions_WorkGroupId", + table: "Subscriptions", + column: "WorkGroupId"); + + migrationBuilder.AddForeignKey( + name: "FK_Subscriptions_WorkGroup_WorkGroupId", + table: "Subscriptions", + column: "WorkGroupId", + principalTable: "WorkGroup", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Subscriptions_WorkGroup_WorkGroupId", + table: "Subscriptions"); + + migrationBuilder.DropTable( + name: "WorkGroup"); + + migrationBuilder.DropIndex( + name: "IX_Subscriptions_WorkGroupId", + table: "Subscriptions"); + + migrationBuilder.DropColumn( + name: "WorkGroupId", + table: "Subscriptions"); + + } + } +} From 4ce61cffe34242a37796a61afbbf0a58ed21d052 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Wed, 21 Jan 2026 20:50:18 +0300 Subject: [PATCH 6/8] Add Search, Create, Update, and Delete handlers for WorkGroup management --- SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs | 7 ++- SW.Bitween.Api/Resources/WorkGroups/Create.cs | 42 +++++++++++++++++ SW.Bitween.Api/Resources/WorkGroups/Delete.cs | 35 ++++++++++++++ SW.Bitween.Api/Resources/WorkGroups/Search.cs | 47 +++++++++++++++++++ SW.Bitween.Api/Resources/WorkGroups/Update.cs | 27 +++++++++++ SW.Bitween.Api/Services/XchangeService.cs | 12 ++++- ...21132821_SubscriptionWorkGroup.Designer.cs | 1 + .../20260121132821_SubscriptionWorkGroup.cs | 1 + .../BitweenDbContextModelSnapshot.cs | 1 + SW.Bitween.Sdk/Model/Workgroups.cs | 42 +++++++++++++++++ 10 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 SW.Bitween.Api/Resources/WorkGroups/Create.cs create mode 100644 SW.Bitween.Api/Resources/WorkGroups/Delete.cs create mode 100644 SW.Bitween.Api/Resources/WorkGroups/Search.cs create mode 100644 SW.Bitween.Api/Resources/WorkGroups/Update.cs create mode 100644 SW.Bitween.Sdk/Model/Workgroups.cs diff --git a/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs b/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs index 7309e4fa..23cef165 100644 --- a/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs +++ b/SW.Bitween.Api/Domain/WorkGroup/WorkGroup.cs @@ -1,3 +1,5 @@ +using SW.Bitween.Domain; +using SW.Bitween.Model; using SW.Bus.RabbitMqExtensions; using SW.PrimitiveTypes; @@ -9,10 +11,7 @@ public interface IWorkGroup string GetBusMessageName(); WorkGroupOptions Options { get; } } -public class WorkGroupOptions -{ - public ConsumerOptions RabbitMqOptions { get; set; } -} + public class WorkGroup : BaseEntity,IWorkGroup { public string Name { get; set; } diff --git a/SW.Bitween.Api/Resources/WorkGroups/Create.cs b/SW.Bitween.Api/Resources/WorkGroups/Create.cs new file mode 100644 index 00000000..ca363b24 --- /dev/null +++ b/SW.Bitween.Api/Resources/WorkGroups/Create.cs @@ -0,0 +1,42 @@ +using System.Threading.Tasks; +using SW.Bitween.Domain; +using SW.Bitween.Model; +using SW.Bus.RabbitMqExtensions; +using SW.PrimitiveTypes; + +namespace SW.Bitween.Resources.WorkGroups; + +public class Create : ICommandHandler +{ + private readonly BitweenDbContext _dbContext; + private readonly RequestContext _requestContext; + + public Create(BitweenDbContext dbContext, RequestContext requestContext) + { + _dbContext = dbContext; + _requestContext = requestContext; + } + + public async Task Handle(CreateWorkGroupModel request) + { + var workgroup = new WorkGroup() + { + Name = request.Name, + BusMessageName = request.BusMessageName, + Options = new WorkGroupOptions() + { + RabbitMqOptions = new ConsumerSettings + { + Prefetch = request.Options?.RabbitMqOptions?.Prefetch, + Priority = request.Options?.RabbitMqOptions?.Priority + } + } + }; + _dbContext.Add(workgroup); + await _dbContext.SaveChangesAsync(); + return new + { + workgroup.Id + }; + } +} \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/WorkGroups/Delete.cs b/SW.Bitween.Api/Resources/WorkGroups/Delete.cs new file mode 100644 index 00000000..f2435ef2 --- /dev/null +++ b/SW.Bitween.Api/Resources/WorkGroups/Delete.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using SW.Bitween.Domain; +using SW.Bitween.Model; +using SW.PrimitiveTypes; + +namespace SW.Bitween.Resources.WorkGroups; + +[HandlerName(nameof(Delete))] +public class Delete : ICommandHandler +{ + private readonly BitweenDbContext _dbContext; + private readonly RequestContext _requestContext; + + public Delete(BitweenDbContext dbContext, RequestContext requestContext) + { + _dbContext = dbContext; + _requestContext = requestContext; + } + + public async Task Handle(int key, DeleteWorkGroupModel _) + { + var category = await _dbContext.Set().FindAsync(key); + if (category is null) + throw new SWValidationException("CATEGORY_NOT_FOUND", $"Workgroup with id {key} was not found"); + + if (await _dbContext.Set().AnyAsync(i => i.WorkGroupId.Value == category.Id)) + throw new SWValidationException("CANT_BE_DELETED", "Workgroup with Subscriptions cant be deleted"); + + //Todo chek rabbitMq + _dbContext.Remove(category); + await _dbContext.SaveChangesAsync(); + return null; + } +} \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/WorkGroups/Search.cs b/SW.Bitween.Api/Resources/WorkGroups/Search.cs new file mode 100644 index 00000000..29b70edd --- /dev/null +++ b/SW.Bitween.Api/Resources/WorkGroups/Search.cs @@ -0,0 +1,47 @@ +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using SW.Bitween.Domain; +using SW.Bitween.Model; +using SW.PrimitiveTypes; + +namespace SW.Bitween.Resources.WorkGroups; + +public class Search(IInfolinkCache infolinkCache) + : IQueryHandler +{ + + public async Task Handle(SearchWorkGroupModel request) + { + request.Limit ??= 20; + request.Offset ??= 0; + + var workGroups = await infolinkCache.ListWorkGroupsAsync(); + + var data= workGroups + .OrderByDescending(i => i.Id) + .Skip(request.Offset.Value) + .Take(request.Limit.Value) + .Select(workGroup => new WorkGroupModel() + { + Id = workGroup.Id, + Name = workGroup.Name, + BusMessageName = workGroup.BusMessageName, + Options = new WorkGroupOptions() + { + RabbitMqOptions = new ConsumerSettings + { + Prefetch =workGroup.Options?.RabbitMqOptions?.Prefetch, + Priority = workGroup.Options?.RabbitMqOptions?.Priority + } + } + }).ToList(); + + + return new + { + Result = workGroups, + TotalCount = data.Count + }; + } +} \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/WorkGroups/Update.cs b/SW.Bitween.Api/Resources/WorkGroups/Update.cs new file mode 100644 index 00000000..e498bbe6 --- /dev/null +++ b/SW.Bitween.Api/Resources/WorkGroups/Update.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using SW.Bitween.Domain; +using SW.Bitween.Model; +using SW.PrimitiveTypes; + +namespace SW.Bitween.Resources.WorkGroups; + +public class Update(BitweenDbContext dbContext) : ICommandHandler +{ + public async Task Handle(int key, CreateWorkGroupModel request) + { + var workGroup = await dbContext.Set().FindAsync(key); + if (workGroup is null) + throw new SWValidationException("WORK_GROUP_NOT_FOUND", $"Category with id {key} was not found"); + workGroup.Name = request.Name; + workGroup.Options = new WorkGroupOptions + { + RabbitMqOptions = new ConsumerSettings + { + Prefetch = request.Options?.RabbitMqOptions?.Prefetch, + Priority = request.Options?.RabbitMqOptions?.Priority + } + }; + await dbContext.SaveChangesAsync(); + return null; + } +} \ No newline at end of file diff --git a/SW.Bitween.Api/Services/XchangeService.cs b/SW.Bitween.Api/Services/XchangeService.cs index ce3c6cb6..ecf5fc39 100644 --- a/SW.Bitween.Api/Services/XchangeService.cs +++ b/SW.Bitween.Api/Services/XchangeService.cs @@ -416,9 +416,17 @@ public async Task> GetMessageTypeNamesWithO foreach (var workGroup in workgroups) { var messageTypeName = workGroup.GetBusMessageName(); - messageTypeNamesWithOptions[messageTypeName] = workGroup.Options.RabbitMqOptions; + messageTypeNamesWithOptions[messageTypeName] = new ConsumerOptions() + { + Prefetch = workGroup.Options?.RabbitMqOptions?.Prefetch, + Priority = workGroup.Options?.RabbitMqOptions?.Priority + }; var messageTypeNameForResponse = $"{messageTypeName}{ResultQueueSuffix}"; - messageTypeNamesWithOptions[messageTypeNameForResponse] = workGroup.Options.RabbitMqOptions; + messageTypeNamesWithOptions[messageTypeNameForResponse] = new ConsumerOptions() + { + Prefetch = workGroup.Options?.RabbitMqOptions?.Prefetch, + Priority = workGroup.Options?.RabbitMqOptions?.Priority + }; } if (!_BitweenSettings.ConsumeLegacyEventMessages) return messageTypeNamesWithOptions; diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs index 7376c800..b6e8cccf 100644 --- a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SW.Bitween.Domain; +using SW.Bitween.Model; using SW.Bitween.PgSql; #nullable disable diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs index 9f4a9fa3..cf6c2f16 100644 --- a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs +++ b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SW.Bitween.Domain; +using SW.Bitween.Model; #nullable disable diff --git a/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs index 796dd665..d4c94b3a 100644 --- a/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs +++ b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SW.Bitween.Domain; +using SW.Bitween.Model; using SW.Bitween.PgSql; #nullable disable diff --git a/SW.Bitween.Sdk/Model/Workgroups.cs b/SW.Bitween.Sdk/Model/Workgroups.cs new file mode 100644 index 00000000..a13559cc --- /dev/null +++ b/SW.Bitween.Sdk/Model/Workgroups.cs @@ -0,0 +1,42 @@ +using System; + +namespace SW.Bitween.Model; +public class ConsumerSettings +{ + public ushort? Prefetch { get; set; } + public int? Priority { get; set; } +} + +public class WorkGroupOptions +{ + public ConsumerSettings RabbitMqOptions { get; set; } +} + +public class WorkGroupModel +{ + public int Id { get; set; } + public string Name { get; set; } + public string BusMessageName { get; set; } + public WorkGroupOptions Options { get; set; } +} + +public class CreateWorkGroupModel +{ + public string Name { get; set; } + public string BusMessageName { get; set; } + public WorkGroupOptions Options { get; set; } +} + +public class SearchWorkGroupModel +{ + public int? Limit { get; set; } + public int? Offset { get; set; } +} + +public class UpdateWorkGroupModel : CreateWorkGroupModel +{ +} + +public class DeleteWorkGroupModel +{ +} \ No newline at end of file From cd0f6b715fc00e88a58e6309c97f8c9d963af921 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Fri, 23 Jan 2026 09:30:33 +0300 Subject: [PATCH 7/8] Update package references and modify database schema for WorkGroup integration --- SW.Bitween.Api/SW.Bitween.Api.csproj | 4 +- SW.Bitween.MsSql/SW.Bitween.MsSql.csproj | 2 +- SW.Bitween.MySql/SW.Bitween.MySql.csproj | 2 +- SW.Bitween.PgSql/BitweenDbContext.cs | 2 +- .../20260121132821_SubscriptionWorkGroup.cs | 489 ------------------ ...3062659_SubscriptionWorkGroup.Designer.cs} | 47 +- .../20260123062659_SubscriptionWorkGroup.cs | 79 +++ .../BitweenDbContextModelSnapshot.cs | 45 +- .../SW.Bitween.SampleHandler.csproj | 2 +- .../SW.Bitween.SampleMapper.csproj | 2 +- .../SW.Bitween.SampleValidator.csproj | 3 +- SW.Bitween.Sdk/SW.Bitween.Sdk.csproj | 2 +- .../SW.Bitween.UnitTests.csproj | 2 +- SW.Bitween.Web/SW.Bitween.Web.csproj | 14 +- 14 files changed, 140 insertions(+), 555 deletions(-) delete mode 100644 SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs rename SW.Bitween.PgSql/Migrations/{20260121132821_SubscriptionWorkGroup.Designer.cs => 20260123062659_SubscriptionWorkGroup.Designer.cs} (97%) create mode 100644 SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.cs diff --git a/SW.Bitween.Api/SW.Bitween.Api.csproj b/SW.Bitween.Api/SW.Bitween.Api.csproj index 09621ebe..77c88057 100644 --- a/SW.Bitween.Api/SW.Bitween.Api.csproj +++ b/SW.Bitween.Api/SW.Bitween.Api.csproj @@ -17,11 +17,11 @@ - + - + diff --git a/SW.Bitween.MsSql/SW.Bitween.MsSql.csproj b/SW.Bitween.MsSql/SW.Bitween.MsSql.csproj index 3cee6407..d13d5790 100644 --- a/SW.Bitween.MsSql/SW.Bitween.MsSql.csproj +++ b/SW.Bitween.MsSql/SW.Bitween.MsSql.csproj @@ -6,7 +6,7 @@ - + diff --git a/SW.Bitween.MySql/SW.Bitween.MySql.csproj b/SW.Bitween.MySql/SW.Bitween.MySql.csproj index f4811e7e..a19cf9f6 100644 --- a/SW.Bitween.MySql/SW.Bitween.MySql.csproj +++ b/SW.Bitween.MySql/SW.Bitween.MySql.csproj @@ -6,7 +6,7 @@ - + diff --git a/SW.Bitween.PgSql/BitweenDbContext.cs b/SW.Bitween.PgSql/BitweenDbContext.cs index 0c4bc533..a3a5cac6 100644 --- a/SW.Bitween.PgSql/BitweenDbContext.cs +++ b/SW.Bitween.PgSql/BitweenDbContext.cs @@ -15,7 +15,7 @@ public class BitweenDbContext : Bitween.BitweenDbContext //private readonly RequestContext requestContext; //private readonly IPublish publish; - public const string Schema = "bitween"; + public const string Schema = "infolink"; public BitweenDbContext(DbContextOptions options, RequestContext requestContext, IPublish publish) : base( options, requestContext, publish) diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs b/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs deleted file mode 100644 index cf6c2f16..00000000 --- a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.cs +++ /dev/null @@ -1,489 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SW.Bitween.Domain; -using SW.Bitween.Model; - -#nullable disable - -namespace SW.Bitween.PgSql.Migrations -{ - public partial class SubscriptionWorkGroup : Migration -{ - protected override void Up(MigrationBuilder migrationBuilder) - { - // 1️⃣ Rename schema (atomic & safe in PostgreSQL) - migrationBuilder.Sql(""" - ALTER SCHEMA infolink RENAME TO bitween; - """); - - // 2️⃣ Add column - migrationBuilder.AddColumn( - name: "work_group_id", - schema: "bitween", - table: "subscription", - type: "integer", - nullable: true); - - // 3️⃣ Create new table - migrationBuilder.CreateTable( - name: "work_group", - schema: "bitween", - columns: table => new - { - id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", - NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(type: "text", nullable: true), - bus_message_name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - options = table.Column(type: "jsonb", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_work_group", x => x.id); - }); - - // 4️⃣ Index + FK - migrationBuilder.CreateIndex( - name: "ix_subscription_work_group_id", - schema: "bitween", - table: "subscription", - column: "work_group_id"); - - migrationBuilder.AddForeignKey( - name: "fk_subscription_work_group_work_group_id", - schema: "bitween", - table: "subscription", - column: "work_group_id", - principalSchema: "bitween", - principalTable: "work_group", - principalColumn: "id"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "work_group", - schema: "bitween"); - - migrationBuilder.DropIndex( - name: "ix_subscription_work_group_id", - schema: "bitween", - table: "subscription"); - - migrationBuilder.DropColumn( - name: "work_group_id", - schema: "bitween", - table: "subscription"); - - migrationBuilder.Sql(""" - ALTER SCHEMA bitween RENAME TO infolink; - """); - } -} - - /// - public partial class SubscriptionWoqrkGroup : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_xchange_aggregation_xchange_xchange_id", - schema: "infolink", - table: "xchange_aggregation"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_delivery_xchange_xchange_id", - schema: "infolink", - table: "xchange_delivery"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_promoted_properties_xchange_xchange_id", - schema: "infolink", - table: "xchange_promoted_properties"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_result_xchange_xchange_id", - schema: "infolink", - table: "xchange_result"); - - migrationBuilder.EnsureSchema( - name: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange_result", - schema: "infolink", - newName: "xchange_result", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange_promoted_properties", - schema: "infolink", - newName: "xchange_promoted_properties", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange_notification", - schema: "infolink", - newName: "xchange_notification", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange_delivery", - schema: "infolink", - newName: "xchange_delivery", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange_aggregation", - schema: "infolink", - newName: "xchange_aggregation", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "xchange", - schema: "infolink", - newName: "xchange", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "subscription_trail", - schema: "infolink", - newName: "subscription_trail", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "subscription_schedule", - schema: "infolink", - newName: "subscription_schedule", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "subscription_category", - schema: "infolink", - newName: "subscription_category", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "subscription", - schema: "infolink", - newName: "subscription", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "running_result", - schema: "infolink", - newName: "running_result", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "RefreshTokens", - schema: "infolink", - newName: "RefreshTokens", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "partner_api_credential", - schema: "infolink", - newName: "partner_api_credential", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "partner", - schema: "infolink", - newName: "partner", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "on_hold_xchange", - schema: "infolink", - newName: "on_hold_xchange", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "notifier", - schema: "infolink", - newName: "notifier", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "document_trail", - schema: "infolink", - newName: "document_trail", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "document", - schema: "infolink", - newName: "document", - newSchema: "bitween"); - - migrationBuilder.RenameTable( - name: "Accounts", - schema: "infolink", - newName: "Accounts", - newSchema: "bitween"); - - migrationBuilder.AddColumn( - name: "work_group_id", - schema: "bitween", - table: "subscription", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "work_group", - schema: "bitween", - columns: table => new - { - id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(type: "text", nullable: true), - bus_message_name = table.Column(type: "character varying(100)", unicode: false, maxLength: 100, nullable: false), - options = table.Column(type: "jsonb", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_work_group", x => x.id); - }); - - migrationBuilder.CreateIndex( - name: "ix_subscription_work_group_id", - schema: "bitween", - table: "subscription", - column: "work_group_id"); - - migrationBuilder.AddForeignKey( - name: "fk_subscription_work_group_work_group_id", - schema: "bitween", - table: "subscription", - column: "work_group_id", - principalSchema: "bitween", - principalTable: "work_group", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_aggregation_xchange_id", - schema: "bitween", - table: "xchange_aggregation", - column: "id", - principalSchema: "bitween", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_delivery_xchange_id", - schema: "bitween", - table: "xchange_delivery", - column: "id", - principalSchema: "bitween", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_promoted_properties_xchange_id", - schema: "bitween", - table: "xchange_promoted_properties", - column: "id", - principalSchema: "bitween", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_result_xchange_id", - schema: "bitween", - table: "xchange_result", - column: "id", - principalSchema: "bitween", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_subscription_work_group_work_group_id", - schema: "bitween", - table: "subscription"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_aggregation_xchange_id", - schema: "bitween", - table: "xchange_aggregation"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_delivery_xchange_id", - schema: "bitween", - table: "xchange_delivery"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_promoted_properties_xchange_id", - schema: "bitween", - table: "xchange_promoted_properties"); - - migrationBuilder.DropForeignKey( - name: "fk_xchange_result_xchange_id", - schema: "bitween", - table: "xchange_result"); - - migrationBuilder.RenameTable( - name: "xchange_result", - schema: "bitween", - newName: "xchange_result", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "xchange_promoted_properties", - schema: "bitween", - newName: "xchange_promoted_properties", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "xchange_notification", - schema: "bitween", - newName: "xchange_notification", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "xchange_delivery", - schema: "bitween", - newName: "xchange_delivery", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "xchange_aggregation", - schema: "bitween", - newName: "xchange_aggregation", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "xchange", - schema: "bitween", - newName: "xchange", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "subscription_trail", - schema: "bitween", - newName: "subscription_trail", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "subscription_schedule", - schema: "bitween", - newName: "subscription_schedule", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "subscription_category", - schema: "bitween", - newName: "subscription_category", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "subscription", - schema: "bitween", - newName: "subscription", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "running_result", - schema: "bitween", - newName: "running_result", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "RefreshTokens", - schema: "bitween", - newName: "RefreshTokens", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "partner_api_credential", - schema: "bitween", - newName: "partner_api_credential", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "partner", - schema: "bitween", - newName: "partner", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "on_hold_xchange", - schema: "bitween", - newName: "on_hold_xchange", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "notifier", - schema: "bitween", - newName: "notifier", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "document_trail", - schema: "bitween", - newName: "document_trail", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "document", - schema: "bitween", - newName: "document", - newSchema: "infolink"); - - migrationBuilder.RenameTable( - name: "Accounts", - schema: "bitween", - newName: "Accounts", - newSchema: "infolink"); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_aggregation_xchange_xchange_id", - schema: "infolink", - table: "xchange_aggregation", - column: "id", - principalSchema: "infolink", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_delivery_xchange_xchange_id", - schema: "infolink", - table: "xchange_delivery", - column: "id", - principalSchema: "infolink", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_promoted_properties_xchange_xchange_id", - schema: "infolink", - table: "xchange_promoted_properties", - column: "id", - principalSchema: "infolink", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_xchange_result_xchange_xchange_id", - schema: "infolink", - table: "xchange_result", - column: "id", - principalSchema: "infolink", - principalTable: "xchange", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs b/SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.Designer.cs similarity index 97% rename from SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs rename to SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.Designer.cs index b6e8cccf..e723106e 100644 --- a/SW.Bitween.PgSql/Migrations/20260121132821_SubscriptionWorkGroup.Designer.cs +++ b/SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.Designer.cs @@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SW.Bitween.Domain; using SW.Bitween.Model; using SW.Bitween.PgSql; @@ -15,7 +14,7 @@ namespace SW.Bitween.PgSql.Migrations { [DbContext(typeof(BitweenDbContext))] - [Migration("20260121132821_SubscriptionWorkGroup")] + [Migration("20260123062659_SubscriptionWorkGroup")] partial class SubscriptionWorkGroup { /// @@ -23,8 +22,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("bitween") - .HasAnnotation("ProductVersion", "8.0.12") + .HasDefaultSchema("infolink") + .HasAnnotation("ProductVersion", "8.0.23") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -105,7 +104,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -149,7 +148,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -200,7 +199,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -253,7 +252,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "bitween"); + b.ToTable("document_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -304,7 +303,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -342,7 +341,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -363,7 +362,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -522,7 +521,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("WorkGroupId") .HasDatabaseName("ix_subscription_work_group_id"); - b.ToTable("subscription", "bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => @@ -565,7 +564,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_subscription_category_code"); - b.ToTable("subscription_category", "bitween"); + b.ToTable("subscription_category", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -608,7 +607,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "bitween"); + b.ToTable("subscription_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => @@ -638,7 +637,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_work_group"); - b.ToTable("work_group", "bitween"); + b.ToTable("work_group", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -738,7 +737,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -764,7 +763,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -784,7 +783,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -825,7 +824,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -853,7 +852,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -928,7 +927,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -937,7 +936,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null, (string)null); }); @@ -998,7 +997,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -1082,7 +1081,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.cs b/SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.cs new file mode 100644 index 00000000..38013732 --- /dev/null +++ b/SW.Bitween.PgSql/Migrations/20260123062659_SubscriptionWorkGroup.cs @@ -0,0 +1,79 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SW.Bitween.Model; + +#nullable disable + +namespace SW.Bitween.PgSql.Migrations +{ + /// + public partial class SubscriptionWorkGroup : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + migrationBuilder.AddColumn( + name: "work_group_id", + schema: "infolink", + table: "subscription", + type: "integer", + nullable: true); + + migrationBuilder.CreateTable( + name: "work_group", + schema: "infolink", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "text", nullable: true), + bus_message_name = table.Column(type: "character varying(100)", unicode: false, maxLength: 100, nullable: false), + options = table.Column(type: "jsonb", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_work_group", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "ix_subscription_work_group_id", + schema: "infolink", + table: "subscription", + column: "work_group_id"); + + migrationBuilder.AddForeignKey( + name: "fk_subscription_work_group_work_group_id", + schema: "infolink", + table: "subscription", + column: "work_group_id", + principalSchema: "infolink", + principalTable: "work_group", + principalColumn: "id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_subscription_work_group_work_group_id", + schema: "infolink", + table: "subscription"); + + migrationBuilder.DropTable( + name: "work_group", + schema: "infolink"); + + migrationBuilder.DropIndex( + name: "ix_subscription_work_group_id", + schema: "infolink", + table: "subscription"); + + migrationBuilder.DropColumn( + name: "work_group_id", + schema: "infolink", + table: "subscription"); + + } + } +} diff --git a/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs index d4c94b3a..fd12606c 100644 --- a/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs +++ b/SW.Bitween.PgSql/Migrations/BitweenDbContextModelSnapshot.cs @@ -5,7 +5,6 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SW.Bitween.Domain; using SW.Bitween.Model; using SW.Bitween.PgSql; @@ -20,8 +19,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema("bitween") - .HasAnnotation("ProductVersion", "8.0.12") + .HasDefaultSchema("infolink") + .HasAnnotation("ProductVersion", "8.0.23") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -102,7 +101,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_accounts_email"); - b.ToTable("Accounts", "bitween"); + b.ToTable("Accounts", "infolink"); b.HasData( new @@ -146,7 +145,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("AccountId") .HasDatabaseName("ix_refresh_tokens_account_id"); - b.ToTable("RefreshTokens", "bitween"); + b.ToTable("RefreshTokens", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Document", b => @@ -197,7 +196,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_document_name"); - b.ToTable("document", "bitween"); + b.ToTable("document", "infolink"); b.HasData( new @@ -250,7 +249,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DocumentId") .HasDatabaseName("ix_document_trail_document_id"); - b.ToTable("document_trail", "bitween"); + b.ToTable("document_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Notifier", b => @@ -301,7 +300,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_notifier"); - b.ToTable("notifier", "bitween"); + b.ToTable("notifier", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.OnHoldXchange", b => @@ -339,7 +338,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_on_hold_xchange_subscription_id"); - b.ToTable("on_hold_xchange", "bitween"); + b.ToTable("on_hold_xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Partner", b => @@ -360,7 +359,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_partner"); - b.ToTable("partner", "bitween"); + b.ToTable("partner", "infolink"); b.HasData( new @@ -519,7 +518,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("WorkGroupId") .HasDatabaseName("ix_subscription_work_group_id"); - b.ToTable("subscription", "bitween"); + b.ToTable("subscription", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionCategory", b => @@ -562,7 +561,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_subscription_category_code"); - b.ToTable("subscription_category", "bitween"); + b.ToTable("subscription_category", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.SubscriptionTrail", b => @@ -605,7 +604,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_subscription_trail_subscription_id"); - b.ToTable("subscription_trail", "bitween"); + b.ToTable("subscription_trail", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.WorkGroup", b => @@ -635,7 +634,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_work_group"); - b.ToTable("work_group", "bitween"); + b.ToTable("work_group", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.Xchange", b => @@ -735,7 +734,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("SubscriptionId") .HasDatabaseName("ix_xchange_subscription_id"); - b.ToTable("xchange", "bitween"); + b.ToTable("xchange", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeAggregation", b => @@ -761,7 +760,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("AggregationXchangeId") .HasDatabaseName("ix_xchange_aggregation_aggregation_xchange_id"); - b.ToTable("xchange_aggregation", "bitween"); + b.ToTable("xchange_aggregation", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeDelivery", b => @@ -781,7 +780,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DeliveredOn") .HasDatabaseName("ix_xchange_delivery_delivered_on"); - b.ToTable("xchange_delivery", "bitween"); + b.ToTable("xchange_delivery", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeNotification", b => @@ -822,7 +821,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_notification"); - b.ToTable("xchange_notification", "bitween"); + b.ToTable("xchange_notification", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangePromotedProperties", b => @@ -850,7 +849,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("PropertiesRaw") .HasDatabaseName("ix_xchange_promoted_properties_properties_raw"); - b.ToTable("xchange_promoted_properties", "bitween"); + b.ToTable("xchange_promoted_properties", "infolink"); }); modelBuilder.Entity("SW.Bitween.Domain.XchangeResult", b => @@ -925,7 +924,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id") .HasName("pk_xchange_result"); - b.ToTable("xchange_result", "bitween"); + b.ToTable("xchange_result", "infolink"); }); modelBuilder.Entity("SW.Bitween.RunFlagUpdater+RunningResult", b => @@ -934,7 +933,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_running"); - b.ToTable("running_result", "bitween"); + b.ToTable("running_result", "infolink"); b.ToView(null, (string)null); }); @@ -995,7 +994,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("ix_partner_api_credential_key"); - b1.ToTable("partner_api_credential", "bitween"); + b1.ToTable("partner_api_credential", "infolink"); b1.WithOwner() .HasForeignKey("PartnerId") @@ -1079,7 +1078,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.HasKey("SubscriptionId", "Id") .HasName("pk_subscription_schedule"); - b1.ToTable("subscription_schedule", "bitween"); + b1.ToTable("subscription_schedule", "infolink"); b1.WithOwner() .HasForeignKey("SubscriptionId") diff --git a/SW.Bitween.SampleHandler/SW.Bitween.SampleHandler.csproj b/SW.Bitween.SampleHandler/SW.Bitween.SampleHandler.csproj index fc6bc72a..e1f52c9c 100644 --- a/SW.Bitween.SampleHandler/SW.Bitween.SampleHandler.csproj +++ b/SW.Bitween.SampleHandler/SW.Bitween.SampleHandler.csproj @@ -7,7 +7,7 @@ - + diff --git a/SW.Bitween.SampleMapper/SW.Bitween.SampleMapper.csproj b/SW.Bitween.SampleMapper/SW.Bitween.SampleMapper.csproj index 0d26f3ff..407d145d 100644 --- a/SW.Bitween.SampleMapper/SW.Bitween.SampleMapper.csproj +++ b/SW.Bitween.SampleMapper/SW.Bitween.SampleMapper.csproj @@ -7,7 +7,7 @@ - + diff --git a/SW.Bitween.SampleValidator/SW.Bitween.SampleValidator.csproj b/SW.Bitween.SampleValidator/SW.Bitween.SampleValidator.csproj index 1b28f2b3..8daa047e 100644 --- a/SW.Bitween.SampleValidator/SW.Bitween.SampleValidator.csproj +++ b/SW.Bitween.SampleValidator/SW.Bitween.SampleValidator.csproj @@ -8,8 +8,7 @@ - - + diff --git a/SW.Bitween.Sdk/SW.Bitween.Sdk.csproj b/SW.Bitween.Sdk/SW.Bitween.Sdk.csproj index cd4e31c6..80b9e875 100644 --- a/SW.Bitween.Sdk/SW.Bitween.Sdk.csproj +++ b/SW.Bitween.Sdk/SW.Bitween.Sdk.csproj @@ -13,7 +13,7 @@ - + diff --git a/SW.Bitween.UnitTests/SW.Bitween.UnitTests.csproj b/SW.Bitween.UnitTests/SW.Bitween.UnitTests.csproj index b8730f90..582b0381 100644 --- a/SW.Bitween.UnitTests/SW.Bitween.UnitTests.csproj +++ b/SW.Bitween.UnitTests/SW.Bitween.UnitTests.csproj @@ -18,7 +18,7 @@ - + diff --git a/SW.Bitween.Web/SW.Bitween.Web.csproj b/SW.Bitween.Web/SW.Bitween.Web.csproj index 6184ac65..57b40c28 100644 --- a/SW.Bitween.Web/SW.Bitween.Web.csproj +++ b/SW.Bitween.Web/SW.Bitween.Web.csproj @@ -16,15 +16,13 @@ - - - - - - - + + + + - + + From 0205a5aa7ed17716d314e87c65140510ac40177e Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Sun, 25 Jan 2026 19:49:13 +0300 Subject: [PATCH 8/8] Refactor WorkGroup command handlers to streamline dependency injection and enhance cache broadcasting --- SW.Bitween.Api/Interfaces/IInfolinkCache.cs | 2 +- .../Resources/Subscriptions/Search.cs | 3 +- SW.Bitween.Api/Resources/WorkGroups/Create.cs | 21 ++++----- SW.Bitween.Api/Resources/WorkGroups/Delete.cs | 22 ++++------ SW.Bitween.Api/Resources/WorkGroups/Search.cs | 43 +++++++++++++------ SW.Bitween.Api/Resources/WorkGroups/Update.cs | 7 ++- SW.Bitween.Api/SW.Bitween.Api.csproj | 2 +- .../Services/Caching/InMemoryInfolinkCache.cs | 4 +- SW.Bitween.Sdk/Model/Workgroups.cs | 8 ++++ SW.Bitween.Web/Program.cs | 3 +- SW.Bitween.Web/SW.Bitween.Web.csproj | 4 +- SW.Bitween.Web/Startup.cs | 1 + 12 files changed, 72 insertions(+), 48 deletions(-) diff --git a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs index a4666711..9f941e79 100644 --- a/SW.Bitween.Api/Interfaces/IInfolinkCache.cs +++ b/SW.Bitween.Api/Interfaces/IInfolinkCache.cs @@ -14,7 +14,7 @@ public interface IInfolinkCache void Revoke(); - void BroadcastRevoke(); + Task BroadcastRevoke(); Task ListWorkGroupsAsync(); Task WorkGroupByIdAsync(int workGroupId); diff --git a/SW.Bitween.Api/Resources/Subscriptions/Search.cs b/SW.Bitween.Api/Resources/Subscriptions/Search.cs index fd829451..3c43116b 100644 --- a/SW.Bitween.Api/Resources/Subscriptions/Search.cs +++ b/SW.Bitween.Api/Resources/Subscriptions/Search.cs @@ -61,7 +61,8 @@ join document in _dbContext.Set() on subscriber.DocumentId equals docu CategoryId = subscriber.CategoryId, WorkGroupId = subscriber.WorkGroupId, CategoryDescription = subscriber.Category.Description, - CategoryCode = subscriber.Category.Code + CategoryCode = subscriber.Category.Code, + }; query = query.AsNoTracking().AsQueryable(); diff --git a/SW.Bitween.Api/Resources/WorkGroups/Create.cs b/SW.Bitween.Api/Resources/WorkGroups/Create.cs index ca363b24..f22e0e3a 100644 --- a/SW.Bitween.Api/Resources/WorkGroups/Create.cs +++ b/SW.Bitween.Api/Resources/WorkGroups/Create.cs @@ -1,21 +1,14 @@ using System.Threading.Tasks; using SW.Bitween.Domain; -using SW.Bitween.Model; -using SW.Bus.RabbitMqExtensions; +using SW.Bitween.Model; using SW.PrimitiveTypes; namespace SW.Bitween.Resources.WorkGroups; -public class Create : ICommandHandler +public class Create(BitweenDbContext dbContext, RequestContext requestContext,IInfolinkCache _BitweenCache, IBroadcast _broadcast) + : ICommandHandler { - private readonly BitweenDbContext _dbContext; - private readonly RequestContext _requestContext; - - public Create(BitweenDbContext dbContext, RequestContext requestContext) - { - _dbContext = dbContext; - _requestContext = requestContext; - } + private readonly RequestContext _requestContext = requestContext; public async Task Handle(CreateWorkGroupModel request) { @@ -32,8 +25,10 @@ public async Task Handle(CreateWorkGroupModel request) } } }; - _dbContext.Add(workgroup); - await _dbContext.SaveChangesAsync(); + dbContext.Add(workgroup); + await dbContext.SaveChangesAsync(); + _BitweenCache.BroadcastRevoke(); + await _broadcast.RefreshConsumers(); return new { workgroup.Id diff --git a/SW.Bitween.Api/Resources/WorkGroups/Delete.cs b/SW.Bitween.Api/Resources/WorkGroups/Delete.cs index f2435ef2..05b5dfed 100644 --- a/SW.Bitween.Api/Resources/WorkGroups/Delete.cs +++ b/SW.Bitween.Api/Resources/WorkGroups/Delete.cs @@ -7,29 +7,25 @@ namespace SW.Bitween.Resources.WorkGroups; [HandlerName(nameof(Delete))] -public class Delete : ICommandHandler +public class Delete(BitweenDbContext dbContext, RequestContext requestContext, IBroadcast _broadcast, IInfolinkCache _infolinkCache) + : ICommandHandler { - private readonly BitweenDbContext _dbContext; - private readonly RequestContext _requestContext; - - public Delete(BitweenDbContext dbContext, RequestContext requestContext) - { - _dbContext = dbContext; - _requestContext = requestContext; - } + private readonly RequestContext _requestContext = requestContext; public async Task Handle(int key, DeleteWorkGroupModel _) { - var category = await _dbContext.Set().FindAsync(key); + var category = await dbContext.Set().FindAsync(key); if (category is null) throw new SWValidationException("CATEGORY_NOT_FOUND", $"Workgroup with id {key} was not found"); - if (await _dbContext.Set().AnyAsync(i => i.WorkGroupId.Value == category.Id)) + if (await dbContext.Set().AnyAsync(i => i.WorkGroupId.Value == category.Id)) throw new SWValidationException("CANT_BE_DELETED", "Workgroup with Subscriptions cant be deleted"); //Todo chek rabbitMq - _dbContext.Remove(category); - await _dbContext.SaveChangesAsync(); + dbContext.Remove(category); + await dbContext.SaveChangesAsync(); + _infolinkCache.BroadcastRevoke(); + await _broadcast.RefreshConsumers(); return null; } } \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/WorkGroups/Search.cs b/SW.Bitween.Api/Resources/WorkGroups/Search.cs index 29b70edd..b64967a7 100644 --- a/SW.Bitween.Api/Resources/WorkGroups/Search.cs +++ b/SW.Bitween.Api/Resources/WorkGroups/Search.cs @@ -3,11 +3,12 @@ using Microsoft.EntityFrameworkCore; using SW.Bitween.Domain; using SW.Bitween.Model; +using SW.Bus.RabbitMqExtensions; using SW.PrimitiveTypes; namespace SW.Bitween.Resources.WorkGroups; -public class Search(IInfolinkCache infolinkCache) +public class Search(IInfolinkCache infolinkCache,IConsumerReader consumerReader) : IQueryHandler { @@ -17,31 +18,47 @@ public async Task Handle(SearchWorkGroupModel request) request.Offset ??= 0; var workGroups = await infolinkCache.ListWorkGroupsAsync(); + var consumerCounts = await consumerReader.GetConsumerCount(); var data= workGroups .OrderByDescending(i => i.Id) .Skip(request.Offset.Value) .Take(request.Limit.Value) - .Select(workGroup => new WorkGroupModel() + .Select(workGroup => { - Id = workGroup.Id, - Name = workGroup.Name, - BusMessageName = workGroup.BusMessageName, - Options = new WorkGroupOptions() + var messageTypeName = workGroup.GetBusMessageName(); + var messageTypeNameForResponse = $"{messageTypeName}{XchangeService.ResultQueueSuffix}"; + var processorsCounts= consumerCounts.FirstOrDefault(c=> c.MessageName == messageTypeName); + var notifiersCounts= consumerCounts.FirstOrDefault(c=> c.MessageName == messageTypeNameForResponse); + return new WorkGroupModel() { - RabbitMqOptions = new ConsumerSettings + Id = workGroup.Id, + Name = workGroup.Name, + BusMessageName = workGroup.BusMessageName, + Options = new WorkGroupOptions() { - Prefetch =workGroup.Options?.RabbitMqOptions?.Prefetch, - Priority = workGroup.Options?.RabbitMqOptions?.Priority - } - } + RabbitMqOptions = new ConsumerSettings + { + Prefetch = workGroup.Options?.RabbitMqOptions?.Prefetch, + Priority = workGroup.Options?.RabbitMqOptions?.Priority + } + }, + ProcessorAckRate = processorsCounts?.AckRate, + ProcessorIncomingRate = processorsCounts?.IncomingRate, + ProcessorProcessingCount = processorsCounts?.ProcessingCount, + ProcessorQueueCount = processorsCounts?.QueueCount, + NotifierAckRate = notifiersCounts?.AckRate, + NotifierIncomingRate = notifiersCounts?.IncomingRate, + NotifierProcessingCount = notifiersCounts?.ProcessingCount, + NotifierQueueCount = notifiersCounts?.QueueCount, + }; }).ToList(); return new { - Result = workGroups, - TotalCount = data.Count + Result = data, + TotalCount = workGroups.Length }; } } \ No newline at end of file diff --git a/SW.Bitween.Api/Resources/WorkGroups/Update.cs b/SW.Bitween.Api/Resources/WorkGroups/Update.cs index e498bbe6..e24ee6b0 100644 --- a/SW.Bitween.Api/Resources/WorkGroups/Update.cs +++ b/SW.Bitween.Api/Resources/WorkGroups/Update.cs @@ -5,7 +5,7 @@ namespace SW.Bitween.Resources.WorkGroups; -public class Update(BitweenDbContext dbContext) : ICommandHandler +public class Update(BitweenDbContext dbContext,IInfolinkCache _BitweenCache, IBroadcast _broadcast) : ICommandHandler { public async Task Handle(int key, CreateWorkGroupModel request) { @@ -21,7 +21,12 @@ public async Task Handle(int key, CreateWorkGroupModel request) Priority = request.Options?.RabbitMqOptions?.Priority } }; + await dbContext.SaveChangesAsync(); + + await _BitweenCache.BroadcastRevoke(); + await _broadcast.RefreshConsumers(); + return null; } } \ No newline at end of file diff --git a/SW.Bitween.Api/SW.Bitween.Api.csproj b/SW.Bitween.Api/SW.Bitween.Api.csproj index 77c88057..22a1ac91 100644 --- a/SW.Bitween.Api/SW.Bitween.Api.csproj +++ b/SW.Bitween.Api/SW.Bitween.Api.csproj @@ -20,7 +20,7 @@ - + diff --git a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs index b32db86e..bf8022bb 100644 --- a/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs +++ b/SW.Bitween.Api/Services/Caching/InMemoryInfolinkCache.cs @@ -105,11 +105,11 @@ public async Task DocumentByNameAsync(string documentName) string.Equals(d.Name, documentName, StringComparison.CurrentCultureIgnoreCase)); } - public void BroadcastRevoke() + public Task BroadcastRevoke() { using var scope = _ssf.CreateScope(); var broadcast = scope.ServiceProvider.GetRequiredService(); - broadcast.Broadcast(new RevokeCacheMessage()); + return broadcast.Broadcast(new RevokeCacheMessage()); } public async Task ListWorkGroupsAsync() diff --git a/SW.Bitween.Sdk/Model/Workgroups.cs b/SW.Bitween.Sdk/Model/Workgroups.cs index a13559cc..969a9935 100644 --- a/SW.Bitween.Sdk/Model/Workgroups.cs +++ b/SW.Bitween.Sdk/Model/Workgroups.cs @@ -18,6 +18,14 @@ public class WorkGroupModel public string Name { get; set; } public string BusMessageName { get; set; } public WorkGroupOptions Options { get; set; } + public double? ProcessorAckRate { get; set; } + public double? ProcessorIncomingRate { get; set; } + public long? ProcessorProcessingCount { get; set; } + public long? ProcessorQueueCount { get; set; } + public double? NotifierAckRate { get; set; } + public double? NotifierIncomingRate { get; set; } + public long? NotifierProcessingCount { get; set; } + public long? NotifierQueueCount { get; set; } } public class CreateWorkGroupModel diff --git a/SW.Bitween.Web/Program.cs b/SW.Bitween.Web/Program.cs index f788c25b..7b52e971 100644 --- a/SW.Bitween.Web/Program.cs +++ b/SW.Bitween.Web/Program.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Hosting; using SW.EfCoreExtensions; using SW.Logger; +using SW.Logger.ElasticSerach; namespace SW.Bitween.Web { @@ -15,7 +16,7 @@ public class Program public static void Main(string[] args) { //var id = (long)(DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalMilliseconds * 1000); - CreateHostBuilder(args).UseSwLogger().Build().MigrateDatabase().Run(); + CreateHostBuilder(args).UseSwElasticSearchLogger().Build().MigrateDatabase().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/SW.Bitween.Web/SW.Bitween.Web.csproj b/SW.Bitween.Web/SW.Bitween.Web.csproj index 57b40c28..7414247a 100644 --- a/SW.Bitween.Web/SW.Bitween.Web.csproj +++ b/SW.Bitween.Web/SW.Bitween.Web.csproj @@ -15,12 +15,12 @@ - + - + diff --git a/SW.Bitween.Web/Startup.cs b/SW.Bitween.Web/Startup.cs index 186659d5..13e1ac15 100644 --- a/SW.Bitween.Web/Startup.cs +++ b/SW.Bitween.Web/Startup.cs @@ -27,6 +27,7 @@ using SW.Bitween.Resources.Accounts; using SW.Bitween.Services; using SW.CqApi.AuthOptions; +using SW.Logger.ElasticSerach; namespace SW.Bitween.Web {