-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #687 from mixcore/feature/update-queue-event-log
Update mix log
- Loading branch information
Showing
42 changed files
with
525 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/platform/mix.constant/Enums/MixQueueMessageLogState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mix.Constant.Enums | ||
{ | ||
public enum MixQueueMessageLogState | ||
{ | ||
ACK, | ||
NACK, | ||
DeadLetter | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...platform/mix.database/Entities/Queue/EntityConfigurations/MixQueueMessageConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mix.Database.Entities.Queue.EntityConfigurations | ||
{ | ||
internal class MixQueueMessageConfiguration : IEntityTypeConfiguration<MixQueueMessageLog> | ||
{ | ||
public IDatabaseConstants Config; | ||
public MixQueueMessageConfiguration() | ||
{ | ||
Config = new SqliteDatabaseConstants(); | ||
} | ||
public void Configure(EntityTypeBuilder<MixQueueMessageLog> builder) | ||
{ | ||
builder.Property(e => e.TopicId) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.SubscriptionId) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.DataTypeFullName) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.Action) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.Note) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.State) | ||
.IsRequired() | ||
.HasConversion(new EnumToStringConverter<MixQueueMessageLogState>()) | ||
.HasColumnType($"{Config.String}{Config.SmallLength}") | ||
.HasCharSet(Config.CharSet); | ||
|
||
builder.Property(e => e.StringData) | ||
.HasColumnType(Config.Text); | ||
|
||
builder.Property(e => e.IsDeleted) | ||
.HasColumnType(Config.Boolean); | ||
|
||
builder.Property(e => e.CreatedDateTime) | ||
.HasColumnType(Config.DateTime); | ||
|
||
builder.Property(e => e.LastModified) | ||
.HasColumnType(Config.DateTime); | ||
|
||
builder.Property(e => e.CreatedBy) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.ModifiedBy) | ||
.HasColumnType($"{Config.String}{Config.MediumLength}"); | ||
|
||
builder.Property(e => e.Priority) | ||
.HasColumnType(Config.Integer); | ||
|
||
builder.Property(e => e.Status) | ||
.IsRequired() | ||
.HasConversion(new EnumToStringConverter<MixContentStatus>()) | ||
.HasColumnType($"{Config.String}{Config.SmallLength}") | ||
.HasCharSet(Config.CharSet); | ||
|
||
builder.Property(e => e.ObjectData) | ||
.HasConversion( | ||
v => v.ToString(Newtonsoft.Json.Formatting.None), | ||
v => !string.IsNullOrEmpty(v) ? JObject.Parse(v) : new()) | ||
.IsRequired(false) | ||
.HasColumnType(Config.Text); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/platform/mix.database/Entities/Queue/MixQueueDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.Extensions.Options; | ||
using Mix.Database.Entities.AuditLog.EntityConfigurations; | ||
using Mix.Database.Entities.Queue.EntityConfigurations; | ||
using Mix.Database.Services; | ||
using Mix.Heart.Services; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mix.Database.Entities.Queue | ||
{ | ||
public sealed class MixQueueDbContext : DbContext | ||
{ | ||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
MixFileHelper.CreateFolderIfNotExist($"{MixFolders.MixQueueLogFolder}/{DateTime.Now.ToString("dd_MM")}"); | ||
string cnn = $"Data Source={MixFolders.MixQueueLogFolder}/{DateTime.Now.ToString("dd_MM")}/queuelog_{DateTime.Now.ToString("dd_MM_yyyy")}.sqlite"; | ||
optionsBuilder.UseSqlite(cnn); | ||
} | ||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.ApplyConfiguration(new MixQueueMessageConfiguration()); | ||
} | ||
|
||
public DbSet<MixQueueMessageLog> MixQueueMessage { get; set; } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/platform/mix.database/Entities/Queue/MixQueueMessageLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mix.Database.Entities.Queue | ||
{ | ||
public sealed class MixQueueMessageLog: EntityBase<Guid> | ||
{ | ||
public Guid QueueMessageId { get; set; } | ||
public string TopicId { get; set; } | ||
public string SubscriptionId { get; set; } | ||
public string Action { get; set; } | ||
public string StringData { get; set; } | ||
public JObject ObjectData { get; set; } | ||
public string DataTypeFullName { get; set; } | ||
public string Note { get; set; } | ||
public MixQueueMessageLogState State { get; set; } | ||
public int TenantId { get; set; } | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
src/platform/mix.database/Migrations/MixQueueDb/20230819041342_InitMixQueueLog.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.