diff --git a/Directory.Build.props b/Directory.Build.props
index 44712305..053ae277 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,5 +1,5 @@
- 0.7.0-preview.25
+ 1.0.0-preview.9
diff --git a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/Masa.Mc.ApiGateways.Caller.csproj b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/Masa.Mc.ApiGateways.Caller.csproj
index 18c73aed..d47aa0e4 100644
--- a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/Masa.Mc.ApiGateways.Caller.csproj
+++ b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/Masa.Mc.ApiGateways.Caller.csproj
@@ -7,7 +7,6 @@
-
diff --git a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/McCaller.cs b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/McCaller.cs
index d0f18b6c..9b175e92 100644
--- a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/McCaller.cs
+++ b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/McCaller.cs
@@ -41,14 +41,11 @@ public class McCaller : HttpClientCallerBase
protected override string BaseAddress { get; set; }
- public override string Name { get; set; }
-
public McCaller(
IServiceProvider serviceProvider,
TokenProvider tokenProvider,
McApiOptions options) : base(serviceProvider)
{
- Name = nameof(McCaller);
BaseAddress = options.McServiceBaseAddress;
_tokenProvider = tokenProvider;
}
diff --git a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/ServiceCollectionExtensions.cs b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/ServiceCollectionExtensions.cs
index 9199d900..a93ed166 100644
--- a/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/ServiceCollectionExtensions.cs
+++ b/src/ApiGateways/Caller/Masa.Mc.ApiGateways.Caller/ServiceCollectionExtensions.cs
@@ -13,7 +13,7 @@ public static IServiceCollection AddMcApiGateways(this IServiceCollection servic
configure?.Invoke(options);
services.AddSingleton(options);
services.AddScoped();
- services.AddCaller(Assembly.Load("Masa.Mc.ApiGateways.Caller"));
+ services.AddAutoRegistrationCaller(Assembly.Load("Masa.Mc.ApiGateways.Caller"));
return services;
}
}
\ No newline at end of file
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskDto.cs
index 710bf84f..dcab66a2 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskDto.cs
@@ -46,4 +46,6 @@ public class MessageTaskDto : AuditEntityDto
public MessageTaskSources Source { get; set; }
public string ModifierName { get; set; } = string.Empty;
+
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskUpsertDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskUpsertDto.cs
index e4685af9..c902a59f 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskUpsertDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/MessageTaskUpsertDto.cs
@@ -38,4 +38,6 @@ public class MessageTaskUpsertDto
public Guid OperatorId { get; set; } = default;
public string SystemId { get; set; } = string.Empty;
+
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
}
\ No newline at end of file
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByExternalInputDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByExternalInputDto.cs
index c05e97ae..b3f97aca 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByExternalInputDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByExternalInputDto.cs
@@ -23,6 +23,8 @@ public class SendOrdinaryMessageByExternalInputDto
public string SystemId { get; set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageByExternalInputDto dto)
{
@@ -45,7 +47,8 @@ public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageByExtern
Variables = dto.Variables,
Source = MessageTaskSources.Sdk,
OperatorId = dto.OperatorId,
- SystemId = dto.SystemId
+ SystemId = dto.SystemId,
+ ExtraProperties = dto.ExtraProperties
};
}
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByInternalInputDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByInternalInputDto.cs
index ea76182e..39a55c0f 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByInternalInputDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageByInternalInputDto.cs
@@ -23,6 +23,8 @@ public class SendOrdinaryMessageByInternalInputDto
public string SystemId { get; set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageByInternalInputDto dto)
{
return new MessageTaskUpsertDto
@@ -39,7 +41,8 @@ public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageByIntern
Variables = dto.Variables,
Source = MessageTaskSources.Sdk,
OperatorId = dto.OperatorId,
- SystemId = dto.SystemId
+ SystemId = dto.SystemId,
+ ExtraProperties = dto.ExtraProperties
};
}
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageTaskInputDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageTaskInputDto.cs
index 82953251..78e6798d 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageTaskInputDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendOrdinaryMessageTaskInputDto.cs
@@ -22,6 +22,8 @@ public class SendOrdinaryMessageTaskInputDto
public Guid OperatorId { get; set; } = default;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageTaskInputDto dto)
{
return new MessageTaskUpsertDto
@@ -38,6 +40,7 @@ public static implicit operator MessageTaskUpsertDto(SendOrdinaryMessageTaskInpu
Variables = dto.Variables,
Source = MessageTaskSources.Sdk,
OperatorId = dto.OperatorId,
+ ExtraProperties = dto.ExtraProperties
};
}
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByExternalInputDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByExternalInputDto.cs
index dc23ec09..5be6c9b5 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByExternalInputDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByExternalInputDto.cs
@@ -25,6 +25,8 @@ public class SendTemplateMessageByExternalInputDto
public string SystemId { get; set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public static implicit operator MessageTaskUpsertDto(SendTemplateMessageByExternalInputDto dto)
{
return new MessageTaskUpsertDto
@@ -46,7 +48,8 @@ public static implicit operator MessageTaskUpsertDto(SendTemplateMessageByExtern
Variables = dto.Variables,
Source = MessageTaskSources.Sdk,
OperatorId = dto.OperatorId,
- SystemId = dto.SystemId
+ SystemId = dto.SystemId,
+ ExtraProperties = dto.ExtraProperties
};
}
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByInternalInputDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByInternalInputDto.cs
index 751d6015..313f3df4 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByInternalInputDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/MessageTasks/SendTemplateMessageByInternalInputDto.cs
@@ -25,6 +25,8 @@ public class SendTemplateMessageByInternalInputDto
public string SystemId { get; set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public static implicit operator MessageTaskUpsertDto(SendTemplateMessageByInternalInputDto dto)
{
return new MessageTaskUpsertDto
@@ -41,7 +43,8 @@ public static implicit operator MessageTaskUpsertDto(SendTemplateMessageByIntern
Variables = dto.Variables,
Source = MessageTaskSources.Sdk,
OperatorId = dto.OperatorId,
- SystemId = dto.SystemId
+ SystemId = dto.SystemId,
+ ExtraProperties = dto.ExtraProperties
};
}
}
diff --git a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/WebsiteMessages/WebsiteMessageDto.cs b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/WebsiteMessages/WebsiteMessageDto.cs
index c7483785..47fedbe8 100644
--- a/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/WebsiteMessages/WebsiteMessageDto.cs
+++ b/src/Contracts/Masa.Mc.Contracts.Admin/Dtos/WebsiteMessages/WebsiteMessageDto.cs
@@ -28,4 +28,6 @@ public class WebsiteMessageDto : AuditEntityDto
public Guid PrevId { get; set; }
public Guid NextId { get; set; }
+
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
}
diff --git a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/CollectionExtensions.cs b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/CollectionExtensions.cs
deleted file mode 100644
index 192da778..00000000
--- a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/CollectionExtensions.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) MASA Stack All rights reserved.
-// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-
-namespace Masa.Mc.Infrastructure.Common.Extensions;
-
-///
-/// Extension methods for Collections.
-///
-public static class CollectionExtensions
-{
- ///
- /// Checks whatever given collection object is null or has no item.
- ///
- public static bool IsNullOrEmpty(this ICollection source)
- {
- return source == null || source.Count <= 0;
- }
-
- ///
- /// Adds an item to the collection if it's not already in the collection.
- ///
- /// The collection
- /// Item to check and add
- /// Type of the items in the collection
- /// Returns True if added, returns False if not.
- public static bool AddIfNotContains(this ICollection source, T item)
- {
- if (source.Contains(item))
- {
- return false;
- }
-
- source.Add(item);
- return true;
- }
-
- ///
- /// Adds items to the collection which are not already in the collection.
- ///
- /// The collection
- /// Item to check and add
- /// Type of the items in the collection
- /// Returns the added items.
- public static IEnumerable AddIfNotContains(this ICollection source, IEnumerable items)
- {
- var addedItems = new List();
-
- foreach (var item in items)
- {
- if (source.Contains(item))
- {
- continue;
- }
-
- source.Add(item);
- addedItems.Add(item);
- }
-
- return addedItems;
- }
-
- ///
- /// Adds an item to the collection if it's not already in the collection based on the given .
- ///
- /// The collection
- /// The condition to decide if the item is already in the collection
- /// A factory that returns the item
- /// Type of the items in the collection
- /// Returns True if added, returns False if not.
- public static bool AddIfNotContains(this ICollection source, Func predicate, Func itemFactory)
- {
- if (source.Any(predicate))
- {
- return false;
- }
-
- source.Add(itemFactory());
- return true;
- }
-
- ///
- /// Removes all items from the collection those satisfy the given .
- ///
- /// Type of the items in the collection
- /// The collection
- /// The condition to remove the items
- /// List of removed items
- public static IList RemoveAll(this ICollection source, Func predicate)
- {
- var items = source.Where(predicate).ToList();
-
- foreach (var item in items)
- {
- source.Remove(item);
- }
-
- return items;
- }
-
- ///
- /// Removes all items from the collection.
- ///
- /// Type of the items in the collection
- /// The collection
- /// Items to be removed from the list
- public static void RemoveAll(this ICollection source, IEnumerable items)
- {
- foreach (var item in items)
- {
- source.Remove(item);
- }
- }
-}
diff --git a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/StringExtensions.cs b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/StringExtensions.cs
deleted file mode 100644
index 330f107a..00000000
--- a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Extensions/StringExtensions.cs
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright (c) MASA Stack All rights reserved.
-// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-
-namespace Masa.Mc.Infrastructure.Common.Extensions;
-
-///
-/// Extension methods for String class.
-///
-public static class StringExtensions
-{
- ///
- /// Adds a char to end of given string if it does not ends with the char.
- ///
- public static string EnsureEndsWith(this string str, char c, StringComparison comparisonType = StringComparison.Ordinal)
- {
- if (str.EndsWith(c.ToString(), comparisonType))
- {
- return str;
- }
-
- return str + c;
- }
-
- ///
- /// Adds a char to beginning of given string if it does not starts with the char.
- ///
- public static string EnsureStartsWith(this string str, char c, StringComparison comparisonType = StringComparison.Ordinal)
- {
- if (str.StartsWith(c.ToString(), comparisonType))
- {
- return str;
- }
-
- return c + str;
- }
-
- ///
- /// Indicates whether this string is null or an System.String.Empty string.
- ///
- public static bool IsNullOrEmpty(this string str)
- {
- return string.IsNullOrEmpty(str);
- }
-
- ///
- /// indicates whether this string is null, empty, or consists only of white-space characters.
- ///
- public static bool IsNullOrWhiteSpace(this string str)
- {
- return string.IsNullOrWhiteSpace(str);
- }
-
- ///
- /// Gets a substring of a string from beginning of the string.
- ///
- /// Thrown if is null
- /// Thrown if is bigger that string's length
- public static string Left(this string str, int len)
- {
- if (str.Length < len)
- {
- throw new ArgumentException("len argument can not be bigger than given string's length!");
- }
-
- return str.Substring(0, len);
- }
-
- ///
- /// Converts line endings in the string to .
- ///
- public static string NormalizeLineEndings(this string str)
- {
- return str.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", Environment.NewLine);
- }
-
- ///
- /// Gets index of nth occurrence of a char in a string.
- ///
- /// source string to be searched
- /// Char to search in
- /// Count of the occurrence
- public static int NthIndexOf(this string str, char c, int n)
- {
- var count = 0;
- for (var i = 0; i < str.Length; i++)
- {
- if (str[i] != c)
- {
- continue;
- }
-
- if ((++count) == n)
- {
- return i;
- }
- }
-
- return -1;
- }
-
- ///
- /// Removes first occurrence of the given postfixes from end of the given string.
- ///
- /// The string.
- /// one or more postfix.
- /// Modified string or the same string if it has not any of given postfixes
- public static string RemovePostFix(this string str, params string[] postFixes)
- {
- return str.RemovePostFix(StringComparison.Ordinal, postFixes);
- }
-
- ///
- /// Removes first occurrence of the given postfixes from end of the given string.
- ///
- /// The string.
- /// String comparison type
- /// one or more postfix.
- /// Modified string or the same string if it has not any of given postfixes
- public static string RemovePostFix(this string str, StringComparison comparisonType, params string[] postFixes)
- {
- if (str.IsNullOrEmpty())
- {
- return str;
- }
-
- if (postFixes.IsNullOrEmpty())
- {
- return str;
- }
-
- foreach (var postFix in postFixes)
- {
- if (str.EndsWith(postFix, comparisonType))
- {
- return str.Left(str.Length - postFix.Length);
- }
- }
-
- return str;
- }
-
- ///
- /// Removes first occurrence of the given prefixes from beginning of the given string.
- ///
- /// The string.
- /// one or more prefix.
- /// Modified string or the same string if it has not any of given prefixes
- public static string RemovePreFix(this string str, params string[] preFixes)
- {
- return str.RemovePreFix(StringComparison.Ordinal, preFixes);
- }
-
- ///
- /// Removes first occurrence of the given prefixes from beginning of the given string.
- ///
- /// The string.
- /// String comparison type
- /// one or more prefix.
- /// Modified string or the same string if it has not any of given prefixes
- public static string RemovePreFix(this string str, StringComparison comparisonType, params string[] preFixes)
- {
- if (str.IsNullOrEmpty())
- {
- return str;
- }
-
- if (preFixes.IsNullOrEmpty())
- {
- return str;
- }
-
- foreach (var preFix in preFixes)
- {
- if (str.StartsWith(preFix, comparisonType))
- {
- return str.Right(str.Length - preFix.Length);
- }
- }
-
- return str;
- }
-
- public static string ReplaceFirst(this string str, string search, string replace, StringComparison comparisonType = StringComparison.Ordinal)
- {
- var pos = str.IndexOf(search, comparisonType);
- if (pos < 0)
- {
- return str;
- }
-
- return str.Substring(0, pos) + replace + str.Substring(pos + search.Length);
- }
-
- ///
- /// Gets a substring of a string from end of the string.
- ///
- /// Thrown if is null
- /// Thrown if is bigger that string's length
- public static string Right(this string str, int len)
- {
- if (str.Length < len)
- {
- throw new ArgumentException("len argument can not be bigger than given string's length!");
- }
-
- return str.Substring(str.Length - len, len);
- }
-
- ///
- /// Uses string.Split method to split given string by given separator.
- ///
- public static string[] Split(this string str, string separator)
- {
- return str.Split(new[] { separator }, StringSplitOptions.None);
- }
-
- ///
- /// Uses string.Split method to split given string by given separator.
- ///
- public static string[] Split(this string str, string separator, StringSplitOptions options)
- {
- return str.Split(new[] { separator }, options);
- }
-
- ///
- /// Uses string.Split method to split given string by .
- ///
- public static string[] SplitToLines(this string str)
- {
- return str.Split(Environment.NewLine);
- }
-
- ///
- /// Uses string.Split method to split given string by .
- ///
- public static string[] SplitToLines(this string str, StringSplitOptions options)
- {
- return str.Split(Environment.NewLine, options);
- }
-
- ///
- /// Converts PascalCase string to camelCase string.
- ///
- /// String to convert
- /// set true to use current culture. Otherwise, invariant culture will be used.
- /// set true to if you want to convert 'XYZ' to 'xyz'.
- /// camelCase of the string
- public static string ToCamelCase(this string str, bool useCurrentCulture = false, bool handleAbbreviations = false)
- {
- if (string.IsNullOrWhiteSpace(str))
- {
- return str;
- }
-
- if (str.Length == 1)
- {
- return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant();
- }
-
- if (handleAbbreviations && IsAllUpperCase(str))
- {
- return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant();
- }
-
- return (useCurrentCulture ? char.ToLower(str[0]) : char.ToLowerInvariant(str[0])) + str.Substring(1);
- }
-
- ///
- /// Converts given PascalCase/camelCase string to sentence (by splitting words by space).
- /// Example: "ThisIsSampleSentence" is converted to "This is a sample sentence".
- ///
- /// String to convert.
- /// set true to use current culture. Otherwise, invariant culture will be used.
- public static string ToSentenceCase(this string str, bool useCurrentCulture = false)
- {
- if (string.IsNullOrWhiteSpace(str))
- {
- return str;
- }
-
- return useCurrentCulture
- ? Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLower(m.Value[1]))
- : Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLowerInvariant(m.Value[1]));
- }
-
- ///
- /// Converts given PascalCase/camelCase string to kebab-case.
- ///
- /// String to convert.
- /// set true to use current culture. Otherwise, invariant culture will be used.
- public static string ToKebabCase(this string str, bool useCurrentCulture = false)
- {
- if (string.IsNullOrEmpty(str))
- {
- return str;
- }
- return Regex.Replace(str, @"(\B[A-Z])", "-$1").ToLower();
- }
-
- ///
- /// Converts given PascalCase/camelCase string to snake case.
- /// Example: "ThisIsSampleSentence" is converted to "this_is_a_sample_sentence".
- /// https://github.com/npgsql/npgsql/blob/dev/src/Npgsql/NameTranslation/NpgsqlSnakeCaseNameTranslator.cs#L51
- ///
- /// String to convert.
- ///
- public static string ToSnakeCase(this string str)
- {
- if (string.IsNullOrWhiteSpace(str))
- {
- return str;
- }
-
- var builder = new StringBuilder(str.Length + Math.Min(2, str.Length / 5));
- var previousCategory = default(UnicodeCategory?);
-
- for (var currentIndex = 0; currentIndex < str.Length; currentIndex++)
- {
- var currentChar = str[currentIndex];
- if (currentChar == '_')
- {
- builder.Append('_');
- previousCategory = null;
- continue;
- }
-
- var currentCategory = char.GetUnicodeCategory(currentChar);
- switch (currentCategory)
- {
- case UnicodeCategory.UppercaseLetter:
- case UnicodeCategory.TitlecaseLetter:
- if (previousCategory == UnicodeCategory.SpaceSeparator ||
- previousCategory == UnicodeCategory.LowercaseLetter ||
- previousCategory != UnicodeCategory.DecimalDigitNumber &&
- previousCategory != null &&
- currentIndex > 0 &&
- currentIndex + 1 < str.Length &&
- char.IsLower(str[currentIndex + 1]))
- {
- builder.Append('_');
- }
-
- currentChar = char.ToLower(currentChar);
- break;
-
- case UnicodeCategory.LowercaseLetter:
- case UnicodeCategory.DecimalDigitNumber:
- if (previousCategory == UnicodeCategory.SpaceSeparator)
- {
- builder.Append('_');
- }
- break;
-
- default:
- if (previousCategory != null)
- {
- previousCategory = UnicodeCategory.SpaceSeparator;
- }
- continue;
- }
-
- builder.Append(currentChar);
- previousCategory = currentCategory;
- }
-
- return builder.ToString();
- }
-
- ///
- /// Converts string to enum value.
- ///
- /// Type of enum
- /// String value to convert
- /// Returns enum object
- public static T ToEnum(this string value)
- where T : struct
- {
- return (T)Enum.Parse(typeof(T), value);
- }
-
- ///
- /// Converts string to enum value.
- ///
- /// Type of enum
- /// String value to convert
- /// Ignore case
- /// Returns enum object
- public static T ToEnum(this string value, bool ignoreCase)
- where T : struct
- {
- return (T)Enum.Parse(typeof(T), value, ignoreCase);
- }
-
- public static string ToMd5(this string str)
- {
- using (var md5 = MD5.Create())
- {
- var inputBytes = Encoding.UTF8.GetBytes(str);
- var hashBytes = md5.ComputeHash(inputBytes);
-
- var sb = new StringBuilder();
- foreach (var hashByte in hashBytes)
- {
- sb.Append(hashByte.ToString("X2"));
- }
-
- return sb.ToString();
- }
- }
-
- ///
- /// Converts camelCase string to PascalCase string.
- ///
- /// String to convert
- /// set true to use current culture. Otherwise, invariant culture will be used.
- /// PascalCase of the string
- public static string ToPascalCase(this string str, bool useCurrentCulture = false)
- {
- if (string.IsNullOrWhiteSpace(str))
- {
- return str;
- }
-
- if (str.Length == 1)
- {
- return useCurrentCulture ? str.ToUpper() : str.ToUpperInvariant();
- }
-
- return (useCurrentCulture ? char.ToUpper(str[0]) : char.ToUpperInvariant(str[0])) + str.Substring(1);
- }
-
- ///
- /// Gets a substring of a string from beginning of the string if it exceeds maximum length.
- ///
- /// Thrown if is null
- public static string Truncate(this string str, int maxLength)
- {
- if (str == null)
- {
- return null;
- }
-
- if (str.Length <= maxLength)
- {
- return str;
- }
-
- return str.Left(maxLength);
- }
-
- ///
- /// Gets a substring of a string from Ending of the string if it exceeds maximum length.
- ///
- /// Thrown if is null
- public static string TruncateFromBeginning(this string str, int maxLength)
- {
- if (str == null)
- {
- return null;
- }
-
- if (str.Length <= maxLength)
- {
- return str;
- }
-
- return str.Right(maxLength);
- }
-
- ///
- /// Gets a substring of a string from beginning of the string if it exceeds maximum length.
- /// It adds a "..." postfix to end of the string if it's truncated.
- /// Returning string can not be longer than maxLength.
- ///
- /// Thrown if is null
- public static string TruncateWithPostfix(this string str, int maxLength)
- {
- return TruncateWithPostfix(str, maxLength, "...");
- }
-
- ///
- /// Gets a substring of a string from beginning of the string if it exceeds maximum length.
- /// It adds given to end of the string if it's truncated.
- /// Returning string can not be longer than maxLength.
- ///
- /// Thrown if is null
- public static string TruncateWithPostfix(this string str, int maxLength, string postfix)
- {
- if (str == null)
- {
- return null;
- }
-
- if (str == string.Empty || maxLength == 0)
- {
- return string.Empty;
- }
-
- if (str.Length <= maxLength)
- {
- return str;
- }
-
- if (maxLength <= postfix.Length)
- {
- return postfix.Left(maxLength);
- }
-
- return str.Left(maxLength - postfix.Length) + postfix;
- }
-
- ///
- /// Converts given string to a byte array using encoding.
- ///
- public static byte[] GetBytes(this string str)
- {
- return str.GetBytes(Encoding.UTF8);
- }
-
- ///
- /// Converts given string to a byte array using the given
- ///
- public static byte[] GetBytes(this string str, Encoding encoding)
- {
- return encoding.GetBytes(str);
- }
-
- private static bool IsAllUpperCase(string input)
- {
- for (int i = 0; i < input.Length; i++)
- {
- if (Char.IsLetter(input[i]) && !Char.IsUpper(input[i]))
- {
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/ReflectionHelper.cs b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/ReflectionHelper.cs
index 71e77e19..acb95e09 100644
--- a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/ReflectionHelper.cs
+++ b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/ReflectionHelper.cs
@@ -51,14 +51,14 @@ private static void AddImplementedGenericTypes(List result, Type givenType
if (givenTypeInfo.IsGenericType && givenType.GetGenericTypeDefinition() == genericType)
{
- result.AddIfNotContains(givenType);
+ result.TryAdd(givenType);
}
foreach (var interfaceType in givenTypeInfo.GetInterfaces())
{
if (interfaceType.GetTypeInfo().IsGenericType && interfaceType.GetGenericTypeDefinition() == genericType)
{
- result.AddIfNotContains(interfaceType);
+ result.TryAdd(interfaceType);
}
}
diff --git a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/TypeHelper.cs b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/TypeHelper.cs
deleted file mode 100644
index f9a42eca..00000000
--- a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Helper/TypeHelper.cs
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright (c) MASA Stack All rights reserved.
-// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-
-namespace Masa.Mc.Infrastructure.Common.Helper;
-
-public static class TypeHelper
-{
- private static readonly HashSet FloatingTypes = new HashSet
- {
- typeof(float),
- typeof(double),
- typeof(decimal)
- };
-
- private static readonly HashSet NonNullablePrimitiveTypes = new HashSet
- {
- typeof(byte),
- typeof(short),
- typeof(int),
- typeof(long),
- typeof(sbyte),
- typeof(ushort),
- typeof(uint),
- typeof(ulong),
- typeof(bool),
- typeof(float),
- typeof(decimal),
- typeof(DateTime),
- typeof(DateTimeOffset),
- typeof(TimeSpan),
- typeof(Guid)
- };
-
- public static bool IsNonNullablePrimitiveType(Type type)
- {
- return NonNullablePrimitiveTypes.Contains(type);
- }
-
- public static bool IsFunc(object obj)
- {
- if (obj == null)
- {
- return false;
- }
-
- var type = obj.GetType();
- if (!type.GetTypeInfo().IsGenericType)
- {
- return false;
- }
-
- return type.GetGenericTypeDefinition() == typeof(Func<>);
- }
-
- public static bool IsFunc(object obj)
- {
- return obj != null && obj.GetType() == typeof(Func);
- }
-
- public static bool IsPrimitiveExtended(Type type, bool includeNullables = true, bool includeEnums = false)
- {
- if (IsPrimitiveExtendedInternal(type, includeEnums))
- {
- return true;
- }
-
- if (includeNullables && IsNullable(type) && type.GenericTypeArguments.Any())
- {
- return IsPrimitiveExtendedInternal(type.GenericTypeArguments[0], includeEnums);
- }
-
- return false;
- }
-
- public static bool IsNullable(Type type)
- {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
- }
-
- public static Type GetFirstGenericArgumentIfNullable(this Type t)
- {
- if (t.GetGenericArguments().Length > 0 && t.GetGenericTypeDefinition() == typeof(Nullable<>))
- {
- return t.GetGenericArguments().FirstOrDefault();
- }
-
- return t;
- }
-
- public static bool IsEnumerable(Type type, out Type itemType, bool includePrimitives = true)
- {
- if (!includePrimitives && IsPrimitiveExtended(type))
- {
- itemType = null;
- return false;
- }
-
- var enumerableTypes = ReflectionHelper.GetImplementedGenericTypes(type, typeof(IEnumerable<>));
- if (enumerableTypes.Count == 1)
- {
- itemType = enumerableTypes[0].GenericTypeArguments[0];
- return true;
- }
-
- if (typeof(System.Collections.IEnumerable).IsAssignableFrom(type))
- {
- itemType = typeof(object);
- return true;
- }
-
- itemType = null;
- return false;
- }
-
- public static bool IsDictionary(Type type, out Type keyType, out Type valueType)
- {
- var dictionaryTypes = ReflectionHelper
- .GetImplementedGenericTypes(
- type,
- typeof(IDictionary<,>)
- );
-
- if (dictionaryTypes.Count == 1)
- {
- keyType = dictionaryTypes[0].GenericTypeArguments[0];
- valueType = dictionaryTypes[0].GenericTypeArguments[1];
- return true;
- }
-
- if (typeof(System.Collections.IDictionary).IsAssignableFrom(type))
- {
- keyType = typeof(object);
- valueType = typeof(object);
- return true;
- }
-
- keyType = null;
- valueType = null;
-
- return false;
- }
-
- private static bool IsPrimitiveExtendedInternal(Type type, bool includeEnums)
- {
- if (type.IsPrimitive)
- {
- return true;
- }
-
- if (includeEnums && type.IsEnum)
- {
- return true;
- }
-
- return type == typeof(string) ||
- type == typeof(decimal) ||
- type == typeof(DateTimeOffset) ||
- type == typeof(DateTimeOffset) ||
- type == typeof(TimeSpan) ||
- type == typeof(Guid);
- }
-
- public static T GetDefaultValue()
- {
- return default;
- }
-
- public static object GetDefaultValue(Type type)
- {
- if (type.IsValueType)
- {
- return Activator.CreateInstance(type);
- }
-
- return null;
- }
-
- public static string GetFullNameHandlingNullableAndGenerics(Type type)
- {
- if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
- {
- return type.GenericTypeArguments[0].FullName + "?";
- }
-
- if (type.IsGenericType)
- {
- var genericType = type.GetGenericTypeDefinition();
- return $"{genericType.FullName.Left(genericType.FullName.IndexOf('`'))}<{type.GenericTypeArguments.Select(GetFullNameHandlingNullableAndGenerics).JoinAsString(",")}>";
- }
-
- return type.FullName ?? type.Name;
- }
-
- public static string GetSimplifiedName(Type type)
- {
- if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
- {
- return GetSimplifiedName(type.GenericTypeArguments[0]) + "?";
- }
-
- if (type.IsGenericType)
- {
- var genericType = type.GetGenericTypeDefinition();
- return $"{genericType.FullName.Left(genericType.FullName.IndexOf('`'))}<{type.GenericTypeArguments.Select(GetSimplifiedName).JoinAsString(",")}>";
- }
-
- if (type == typeof(string))
- {
- return "string";
- }
- else if (type == typeof(int))
- {
- return "number";
- }
- else if (type == typeof(long))
- {
- return "number";
- }
- else if (type == typeof(bool))
- {
- return "boolean";
- }
- else if (type == typeof(char))
- {
- return "string";
- }
- else if (type == typeof(double))
- {
- return "number";
- }
- else if (type == typeof(float))
- {
- return "number";
- }
- else if (type == typeof(decimal))
- {
- return "number";
- }
- else if (type == typeof(DateTimeOffset))
- {
- return "string";
- }
- else if (type == typeof(DateTimeOffset))
- {
- return "string";
- }
- else if (type == typeof(TimeSpan))
- {
- return "string";
- }
- else if (type == typeof(Guid))
- {
- return "string";
- }
- else if (type == typeof(byte))
- {
- return "number";
- }
- else if (type == typeof(sbyte))
- {
- return "number";
- }
- else if (type == typeof(short))
- {
- return "number";
- }
- else if (type == typeof(ushort))
- {
- return "number";
- }
- else if (type == typeof(uint))
- {
- return "number";
- }
- else if (type == typeof(ulong))
- {
- return "number";
- }
- else if (type == typeof(IntPtr))
- {
- return "number";
- }
- else if (type == typeof(UIntPtr))
- {
- return "number";
- }
- else if (type == typeof(object))
- {
- return "object";
- }
-
- return type.FullName ?? type.Name;
- }
-
- public static bool IsFloatingType(Type type, bool includeNullable = true)
- {
- if (FloatingTypes.Contains(type))
- {
- return true;
- }
-
- if (includeNullable &&
- IsNullable(type) &&
- FloatingTypes.Contains(type.GenericTypeArguments[0]))
- {
- return true;
- }
-
- return false;
- }
-
- public static object ConvertFrom(object value)
- {
- return ConvertFrom(typeof(TTargetType), value);
- }
-
- public static object ConvertFrom(Type targetType, object value)
- {
- return TypeDescriptor
- .GetConverter(targetType)
- .ConvertFrom(value);
- }
-
- public static Type StripNullable(Type type)
- {
- return IsNullable(type)
- ? type.GenericTypeArguments[0]
- : type;
- }
-
- public static bool IsDefaultValue(object obj)
- {
- if (obj == null)
- {
- return true;
- }
-
- return obj.Equals(GetDefaultValue(obj.GetType()));
- }
-}
diff --git a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Masa.Mc.Infrastructure.Common.csproj b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Masa.Mc.Infrastructure.Common.csproj
index b309d428..4f39021e 100644
--- a/src/Infrastructure/Masa.Mc.Infrastructure.Common/Masa.Mc.Infrastructure.Common.csproj
+++ b/src/Infrastructure/Masa.Mc.Infrastructure.Common/Masa.Mc.Infrastructure.Common.csproj
@@ -7,7 +7,8 @@
-
+
+
diff --git a/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryAppMessageEventHandler.cs b/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryAppMessageEventHandler.cs
index 7d5937d4..33a26f65 100644
--- a/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryAppMessageEventHandler.cs
+++ b/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryAppMessageEventHandler.cs
@@ -13,6 +13,7 @@ public class RetryAppMessageEventHandler
private readonly MessageTemplateDomainService _messageTemplateDomainService;
private readonly IMessageTemplateRepository _repository;
private readonly IWebsiteMessageRepository _websiteMessageRepository;
+ private readonly IMessageTaskRepository _messageTaskRepository;
private readonly II18n _i18n;
public RetryAppMessageEventHandler(IAppNotificationAsyncLocal appNotificationAsyncLocal
@@ -23,6 +24,7 @@ public RetryAppMessageEventHandler(IAppNotificationAsyncLocal appNotificationAsy
, MessageTemplateDomainService messageTemplateDomainService
, IMessageTemplateRepository repository
, IWebsiteMessageRepository websiteMessageRepository
+ , IMessageTaskRepository messageTaskRepository
, II18n i18n)
{
_appNotificationAsyncLocal = appNotificationAsyncLocal;
@@ -33,6 +35,7 @@ public RetryAppMessageEventHandler(IAppNotificationAsyncLocal appNotificationAsy
_messageTemplateDomainService = messageTemplateDomainService;
_repository = repository;
_websiteMessageRepository = websiteMessageRepository;
+ _messageTaskRepository = messageTaskRepository;
_i18n = i18n;
}
@@ -75,9 +78,10 @@ public async Task HandleEventAsync(RetryAppMessageEvent eto)
{
messageRecord.SetResult(true, string.Empty);
- if (messageData.MessageContent.ExtraProperties.GetProperty("IsWebsiteMessage"))
+ var messageTask = await _messageTaskRepository.FindAsync(x => x.Id == messageRecord.MessageTaskId);
+ if (messageTask != null && messageTask.IsAppInWebsiteMessage())
{
- var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, messageRecord.UserId, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now);
+ var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, messageRecord.UserId, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now, messageData.MessageContent.ExtraProperties);
await _websiteMessageRepository.AddAsync(websiteMessage);
}
}
diff --git a/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryWebsiteMessageEventHandler.cs b/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryWebsiteMessageEventHandler.cs
index e1487669..a6ac613d 100644
--- a/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryWebsiteMessageEventHandler.cs
+++ b/src/Services/Masa.Mc.Service/Application/MessageRecords/EventHandler/RetryWebsiteMessageEventHandler.cs
@@ -19,7 +19,7 @@ public RetryWebsiteMessageEventHandler(IHubContext hubContext
, IWebsiteMessageRepository repository
, MessageTemplateDomainService messageTemplateDomainService
, IMessageTemplateRepository templateRepository
- , II18n i18n )
+ , II18n i18n)
{
_hubContext = hubContext;
_messageRecordRepository = messageRecordRepository;
@@ -41,7 +41,7 @@ public async Task HandleEventAsync(RetryWebsiteMessageEvent eto)
if (messageData.MessageType == MessageEntityTypes.Template)
{
var messageTemplate = await _templateRepository.FindAsync(x => x.Id == messageRecord.MessageEntityId, false);
- if(!await _messageTemplateDomainService.CheckSendUpperLimitAsync(messageTemplate, messageRecord.ChannelUserIdentity))
+ if (!await _messageTemplateDomainService.CheckSendUpperLimitAsync(messageTemplate, messageRecord.ChannelUserIdentity))
{
messageRecord.SetResult(false, _i18n.T("DailySendingLimit"));
await _messageRecordRepository.UpdateAsync(messageRecord);
@@ -49,7 +49,7 @@ public async Task HandleEventAsync(RetryWebsiteMessageEvent eto)
}
}
- var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, messageRecord.UserId, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now);
+ var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, messageRecord.UserId, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now, messageData.MessageContent.ExtraProperties);
await _repository.AddAsync(websiteMessage);
messageRecord.SetResult(true, string.Empty);
diff --git a/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendAppMessageEventHandler.cs b/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendAppMessageEventHandler.cs
index e3e558cf..51279ac4 100644
--- a/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendAppMessageEventHandler.cs
+++ b/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendAppMessageEventHandler.cs
@@ -83,9 +83,9 @@ public async Task HandleEventAsync(SendAppMessageEvent eto)
{
messageRecord.SetResult(true, string.Empty);
- if (eto.MessageData.MessageContent.ExtraProperties.GetProperty("IsWebsiteMessage"))
+ if (taskHistory.MessageTask.IsAppInWebsiteMessage())
{
- var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, item.UserId, eto.MessageData.MessageContent.Title, eto.MessageData.MessageContent.Content, eto.MessageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now);
+ var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, item.UserId, eto.MessageData.MessageContent.Title, eto.MessageData.MessageContent.Content, eto.MessageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now, eto.MessageData.ExtraProperties);
await _websiteMessageRepository.AddAsync(websiteMessage);
}
okCount++;
diff --git a/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendWebsiteMessageEventHandler.cs b/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendWebsiteMessageEventHandler.cs
index f7989ad6..68f99278 100644
--- a/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendWebsiteMessageEventHandler.cs
+++ b/src/Services/Masa.Mc.Service/Application/MessageTasks/EventHandler/SendWebsiteMessageEventHandler.cs
@@ -61,7 +61,7 @@ public async Task HandleEventAsync(SendWebsiteMessageEvent eto)
messageRecord.SetResult(true, string.Empty);
- var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, item.UserId, eto.MessageData.MessageContent.Title, eto.MessageData.MessageContent.Content, eto.MessageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now);
+ var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, item.UserId, eto.MessageData.MessageContent.Title, eto.MessageData.MessageContent.Content, eto.MessageData.MessageContent.GetJumpUrl(), DateTimeOffset.Now, eto.MessageData.MessageContent.ExtraProperties);
await _messageRecordRepository.AddAsync(messageRecord);
await _websiteMessageRepository.AddAsync(websiteMessage);
diff --git a/src/Services/Masa.Mc.Service/Application/MessageTasks/MessageTaskQueryHandler.cs b/src/Services/Masa.Mc.Service/Application/MessageTasks/MessageTaskQueryHandler.cs
index 1a79a473..214fe3cb 100644
--- a/src/Services/Masa.Mc.Service/Application/MessageTasks/MessageTaskQueryHandler.cs
+++ b/src/Services/Masa.Mc.Service/Application/MessageTasks/MessageTaskQueryHandler.cs
@@ -34,7 +34,15 @@ public async Task GetAsync(GetMessageTaskQuery query)
var entity = await _context.MessageTaskQueries.Include(x => x.Channel).FirstOrDefaultAsync(x => x.Id == query.MessageTaskId);
MasaArgumentException.ThrowIfNull(entity, _i18n.T("MessageTask"));
- query.Result = entity.Adapt();
+ var dto = entity.Adapt();
+
+ if (entity.EntityType == MessageEntityTypes.Ordinary)
+ {
+ var info = await _context.MessageInfoQueries.FirstOrDefaultAsync(x => x.Id == entity.EntityId);
+ dto.MessageInfo = info?.Adapt() ?? new();
+ }
+
+ query.Result = dto;
}
[EventHandler]
@@ -87,7 +95,7 @@ public async Task ResolveReceiversCountAsync(ResolveReceiversCountQuery query)
private async Task ResolveReceiverGroupCount(Guid receiverGroupId)
{
long receiverGroupCount = 0;
- var receiverGroup = await _context.ReceiverGroupQueries.Include(x=>x.Items).FirstOrDefaultAsync(x => x.Id == receiverGroupId);
+ var receiverGroup = await _context.ReceiverGroupQueries.Include(x => x.Items).FirstOrDefaultAsync(x => x.Id == receiverGroupId);
if (receiverGroup == null)
{
return receiverGroupCount;
@@ -122,7 +130,7 @@ private async Task ResolveAuthUsersCount(ReceiverGroupItemTypes type, Guid
private async Task>> CreateFilteredPredicate(GetMessageTaskInputDto inputDto)
{
- Expression> condition = x => x.Channel!=null;
+ Expression> condition = x => x.Channel != null;
condition = condition.And(!string.IsNullOrEmpty(inputDto.Filter), x => x.DisplayName.Contains(inputDto.Filter));
condition = condition.And(inputDto.EntityType.HasValue, x => x.EntityType == inputDto.EntityType);
condition = condition.And(inputDto.ChannelId.HasValue, x => x.ChannelId == inputDto.ChannelId);
@@ -147,7 +155,7 @@ private async Task>> CreateFiltered
[EventHandler]
public async Task GenerateImportTemplateAsync(GenerateReceiverImportTemplateQuery query)
{
- var template = await _context.MessageTemplateQueries.Include(x=>x.Items).FirstOrDefaultAsync(x => x.Id == query.MessageTemplateId);
+ var template = await _context.MessageTemplateQueries.Include(x => x.Items).FirstOrDefaultAsync(x => x.Id == query.MessageTemplateId);
var record = new ExpandoObject();
var properties = GetReceiverImportDtoType(query.ChannelType).GetProperties();
foreach (var prop in properties)
diff --git a/src/Services/Masa.Mc.Service/Application/QueryModels/MessageTaskQueryModel.cs b/src/Services/Masa.Mc.Service/Application/QueryModels/MessageTaskQueryModel.cs
index d674011b..0b726c22 100644
--- a/src/Services/Masa.Mc.Service/Application/QueryModels/MessageTaskQueryModel.cs
+++ b/src/Services/Masa.Mc.Service/Application/QueryModels/MessageTaskQueryModel.cs
@@ -43,6 +43,8 @@ public class MessageTaskQueryModel : Entity, ISoftDelete
public string SystemId { get; set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public Guid Creator { get; set; }
public DateTime CreationTime { get; set; }
diff --git a/src/Services/Masa.Mc.Service/Application/QueryModels/WebsiteMessageQueryModel.cs b/src/Services/Masa.Mc.Service/Application/QueryModels/WebsiteMessageQueryModel.cs
index b4ed9e6f..f9dc01a9 100644
--- a/src/Services/Masa.Mc.Service/Application/QueryModels/WebsiteMessageQueryModel.cs
+++ b/src/Services/Masa.Mc.Service/Application/QueryModels/WebsiteMessageQueryModel.cs
@@ -27,6 +27,8 @@ public class WebsiteMessageQueryModel : Entity, ISoftDelete
public Guid MessageTaskHistoryId { get; set; }
+ public ExtraPropertyDictionary ExtraProperties { get; set; } = new();
+
public Guid Creator { get; set; }
public DateTime CreationTime { get; set; }
diff --git a/src/Services/Masa.Mc.Service/Domain/MessageTasks/Aggregates/MessageTask.cs b/src/Services/Masa.Mc.Service/Domain/MessageTasks/Aggregates/MessageTask.cs
index 60408ecf..169f060a 100644
--- a/src/Services/Masa.Mc.Service/Domain/MessageTasks/Aggregates/MessageTask.cs
+++ b/src/Services/Masa.Mc.Service/Domain/MessageTasks/Aggregates/MessageTask.cs
@@ -47,9 +47,11 @@ public class MessageTask : FullAggregateRoot
public string SystemId { get; protected set; } = string.Empty;
+ public ExtraPropertyDictionary ExtraProperties { get; protected set; } = new();
+
private MessageTask() { }
- public MessageTask(string displayName, ChannelType? channelType, Guid? channelId, MessageEntityTypes entityType, Guid entityId, bool isDraft, string sign, ReceiverTypes receiverType, MessageTaskSelectReceiverTypes selectReceiverType, List receivers, MessageTaskSendingRule sendRules, MessageTaskSources source, string systemId)
+ public MessageTask(string displayName, ChannelType? channelType, Guid? channelId, MessageEntityTypes entityType, Guid entityId, bool isDraft, string sign, ReceiverTypes receiverType, MessageTaskSelectReceiverTypes selectReceiverType, List receivers, MessageTaskSendingRule sendRules, MessageTaskSources source, string systemId, ExtraPropertyDictionary extraProperties)
{
DisplayName = displayName;
ChannelType = channelType;
@@ -64,6 +66,7 @@ public MessageTask(string displayName, ChannelType? channelType, Guid? channelId
Status = MessageTaskStatuses.WaitSend;
Source = source;
SystemId = systemId;
+ ExtraProperties = extraProperties;
}
public virtual void SetEnabled()
@@ -171,4 +174,9 @@ public List GetHistoryReceiverUsers(int historyNum, int sen
{
return ReceiverUsers.Skip(historyNum * sendingCount).Take(sendingCount).ToList(); ;
}
+
+ public bool IsAppInWebsiteMessage()
+ {
+ return ChannelType?.Id == ChannelType.App.Id && ExtraProperties.GetProperty("IsWebsiteMessage");
+ }
}
\ No newline at end of file
diff --git a/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/Aggregates/WebsiteMessage.cs b/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/Aggregates/WebsiteMessage.cs
index 2a4c09c9..9b260e16 100644
--- a/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/Aggregates/WebsiteMessage.cs
+++ b/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/Aggregates/WebsiteMessage.cs
@@ -27,11 +27,13 @@ public class WebsiteMessage : FullAggregateRoot
public Guid MessageTaskHistoryId { get; protected set; }
- public WebsiteMessage(Guid channelId, Guid userId, string title, string content, string linkUrl, DateTimeOffset sendTime) : this(channelId, userId, title, content, linkUrl, sendTime, false, null)
+ public ExtraPropertyDictionary ExtraProperties { get; protected set; } = new();
+
+ public WebsiteMessage(Guid channelId, Guid userId, string title, string content, string linkUrl, DateTimeOffset sendTime, ExtraPropertyDictionary extraProperties) : this(channelId, userId, title, content, linkUrl, sendTime, false, null, extraProperties)
{
}
- public WebsiteMessage(Guid channelId, Guid userId, string title, string content, string linkUrl, DateTimeOffset sendTime, bool isRead, DateTimeOffset? readTime)
+ public WebsiteMessage(Guid channelId, Guid userId, string title, string content, string linkUrl, DateTimeOffset sendTime, bool isRead, DateTimeOffset? readTime, ExtraPropertyDictionary extraProperties)
{
ChannelId = channelId;
UserId = userId;
@@ -41,6 +43,7 @@ public WebsiteMessage(Guid channelId, Guid userId, string title, string content,
SendTime = sendTime;
IsRead = isRead;
ReadTime = readTime;
+ ExtraProperties = extraProperties;
}
public void SetRead()
diff --git a/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/EventHandler/WebsiteMessageCreatedEventHandler.cs b/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/EventHandler/WebsiteMessageCreatedEventHandler.cs
index 28321855..eaaaad7f 100644
--- a/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/EventHandler/WebsiteMessageCreatedEventHandler.cs
+++ b/src/Services/Masa.Mc.Service/Domain/WebsiteMessages/EventHandler/WebsiteMessageCreatedEventHandler.cs
@@ -45,7 +45,7 @@ public async Task HandleEvent(AddWebsiteMessageDomainEvent @event)
messageRecord.SetMessageEntity(taskHistory.MessageTask.EntityType, taskHistory.MessageTask.EntityId);
messageRecord.SetResult(true, string.Empty, taskHistory.SendTime);
- var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, currentUser.Id, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), taskHistory.SendTime ?? DateTimeOffset.Now);
+ var websiteMessage = new WebsiteMessage(messageRecord.ChannelId, currentUser.Id, messageData.MessageContent.Title, messageData.MessageContent.Content, messageData.MessageContent.GetJumpUrl(), taskHistory.SendTime ?? DateTimeOffset.Now, messageData.MessageContent.ExtraProperties);
await _messageRecordRepository.AddAsync(messageRecord);
await _websiteMessageRepository.AddAsync(websiteMessage);
}
diff --git a/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McDbContextModelBuilderExtensions.cs b/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McDbContextModelBuilderExtensions.cs
index 839c09c2..8201f781 100644
--- a/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McDbContextModelBuilderExtensions.cs
+++ b/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McDbContextModelBuilderExtensions.cs
@@ -90,6 +90,7 @@ public static void ConfigureMC(this ModelBuilder builder)
b.Property(x => x.ReceiverUsers).HasConversion(new JsonValueConverter>());
b.Property(x => x.ChannelType).HasConversion(x => x.Id, x => Enumeration.FromValue(x));
b.Property(x => x.SystemId).HasMaxLength(128);
+ b.Property(x => x.ExtraProperties).HasConversion(new ExtraPropertiesValueConverter()).Metadata.SetValueComparer(new ExtraPropertyDictionaryValueComparer());
});
builder.Entity(b =>
@@ -139,6 +140,7 @@ public static void ConfigureMC(this ModelBuilder builder)
b.Property(x => x.Title).IsRequired().HasMaxLength(128);
b.Property(x => x.LinkUrl).HasMaxLength(256);
b.HasIndex(x => new { x.UserId, x.ChannelId });
+ b.Property(x => x.ExtraProperties).HasConversion(new ExtraPropertiesValueConverter()).Metadata.SetValueComparer(new ExtraPropertyDictionaryValueComparer());
});
builder.Entity(b =>
diff --git a/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McQueryContext.cs b/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McQueryContext.cs
index 05473f9b..63320c52 100644
--- a/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McQueryContext.cs
+++ b/src/Services/Masa.Mc.Service/Infrastructure/EntityFrameworkCore/McQueryContext.cs
@@ -61,6 +61,7 @@ protected override void OnModelCreatingExecuting(ModelBuilder builder)
b.Property(x => x.Receivers).HasConversion(new JsonValueConverter>());
b.Property(x => x.SendRules).HasConversion(new JsonValueConverter());
b.Property(x => x.Variables).HasConversion(new ExtraPropertiesValueConverter()).Metadata.SetValueComparer(new ExtraPropertyDictionaryValueComparer());
+ b.Property(x => x.ExtraProperties).HasConversion(new ExtraPropertiesValueConverter()).Metadata.SetValueComparer(new ExtraPropertyDictionaryValueComparer());
});
builder.Entity(b =>
@@ -89,6 +90,7 @@ protected override void OnModelCreatingExecuting(ModelBuilder builder)
builder.Entity(b =>
{
b.ToView(MCConsts.DbTablePrefix + "WebsiteMessages", MCConsts.DbSchema);
+ b.Property(x => x.ExtraProperties).HasConversion(new ExtraPropertiesValueConverter()).Metadata.SetValueComparer(new ExtraPropertyDictionaryValueComparer());
});
base.OnModelCreatingExecuting(builder);
diff --git a/src/Services/Masa.Mc.Service/Infrastructure/Middleware/LogMiddleware.cs b/src/Services/Masa.Mc.Service/Infrastructure/Middleware/LogMiddleware.cs
index db3833b3..3a3e0a2a 100644
--- a/src/Services/Masa.Mc.Service/Infrastructure/Middleware/LogMiddleware.cs
+++ b/src/Services/Masa.Mc.Service/Infrastructure/Middleware/LogMiddleware.cs
@@ -3,7 +3,7 @@
namespace Masa.Mc.Service.Infrastructure.Middleware;
-public class LogMiddleware : IMiddleware
+public class LogMiddleware : IEventMiddleware
where TEvent : notnull, IEvent
{
private readonly ILogger> _logger;
diff --git a/src/Services/Masa.Mc.Service/Infrastructure/Middleware/ValidatorMiddleware.cs b/src/Services/Masa.Mc.Service/Infrastructure/Middleware/ValidatorMiddleware.cs
index eb0bef96..be974c58 100644
--- a/src/Services/Masa.Mc.Service/Infrastructure/Middleware/ValidatorMiddleware.cs
+++ b/src/Services/Masa.Mc.Service/Infrastructure/Middleware/ValidatorMiddleware.cs
@@ -3,7 +3,7 @@
namespace Masa.Mc.Service.Infrastructure.Middleware;
-public class ValidatorMiddleware : IMiddleware
+public class ValidatorMiddleware : IEventMiddleware
where TEvent : notnull, IEvent
{
private readonly ILogger> _logger;
diff --git a/src/Services/Masa.Mc.Service/Migrations/20230220062618_MessageTaskExtraProperties.Designer.cs b/src/Services/Masa.Mc.Service/Migrations/20230220062618_MessageTaskExtraProperties.Designer.cs
new file mode 100644
index 00000000..76f61b31
--- /dev/null
+++ b/src/Services/Masa.Mc.Service/Migrations/20230220062618_MessageTaskExtraProperties.Designer.cs
@@ -0,0 +1,1030 @@
+//
+using System;
+using Masa.Mc.Service.Admin.Infrastructure.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Masa.Mc.Service.Admin.Migrations
+{
+ [DbContext(typeof(McDbContext))]
+ [Migration("20230220062618_MessageTaskExtraProperties")]
+ partial class MessageTaskExtraProperties
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.7")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("Masa.BuildingBlocks.Dispatcher.IntegrationEvents.Logs.IntegrationEventLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("EventId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("EventTypeName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("RowVersion")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(36)
+ .HasColumnType("nvarchar(36)")
+ .HasColumnName("RowVersion");
+
+ b.Property("State")
+ .HasColumnType("int");
+
+ b.Property("TimesSent")
+ .HasColumnType("int");
+
+ b.Property("TransactionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "EventId", "RowVersion" }, "IX_EventId_Version");
+
+ b.HasIndex(new[] { "State", "ModificationTime" }, "IX_State_MTime");
+
+ b.HasIndex(new[] { "State", "TimesSent", "ModificationTime" }, "IX_State_TimesSent_MTime");
+
+ b.ToTable("IntegrationEventLog", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.AppChannel", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("Code");
+
+ b.Property("Color")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("Color");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("Type")
+ .ValueGeneratedOnUpdateSometimes()
+ .HasColumnType("int")
+ .HasColumnName("Type");
+
+ b.HasKey("Id");
+
+ b.ToTable("Channels", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.Channel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)")
+ .HasColumnName("Code");
+
+ b.Property("Color")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("Color");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("DisplayName");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsStatic")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Type")
+ .ValueGeneratedOnUpdateSometimes()
+ .HasColumnType("int")
+ .HasColumnName("Type");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Code");
+
+ b.HasIndex("Type");
+
+ b.ToTable("Channels", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageInfos.Aggregates.MessageInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("MessageInfos", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageRecords.Aggregates.MessageRecord", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelUserIdentity")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("ExpectSendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FailureReason")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("MessageEntityId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MessageEntityType")
+ .HasColumnType("int");
+
+ b.Property("MessageTaskHistoryId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MessageTaskId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Success")
+ .HasColumnType("bit");
+
+ b.Property("SystemId")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Variables")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChannelId");
+
+ b.HasIndex("MessageTaskHistoryId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("MessageRecords", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageReceiverUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelUserIdentity")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("MessageTaskHistoryId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Variables")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("MessageTaskHistoryId");
+
+ b.ToTable("MessageReceiverUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTask", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelType")
+ .HasColumnType("int");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("EntityId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("EntityType")
+ .HasColumnType("int");
+
+ b.Property("ExpectSendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsDraft")
+ .HasColumnType("bit");
+
+ b.Property("IsEnabled")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ReceiverType")
+ .HasColumnType("int");
+
+ b.Property("ReceiverUsers")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Receivers")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SchedulerJobId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SelectReceiverType")
+ .HasColumnType("int");
+
+ b.Property("SendRules")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Sign")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Source")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("SystemId")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Variables")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChannelId");
+
+ b.ToTable("MessageTasks", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTaskHistory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CompletionTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsTest")
+ .HasColumnType("bit");
+
+ b.Property("MessageTaskId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SchedulerTaskId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("TaskHistoryNo")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("WithdrawTime")
+ .HasColumnType("datetimeoffset");
+
+ b.HasKey("Id");
+
+ b.HasIndex("MessageTaskId");
+
+ b.ToTable("MessageTaskHistorys", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTemplates.Aggregates.MessageTemplate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AuditReason")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("AuditStatus")
+ .HasColumnType("int");
+
+ b.Property("AuditTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("ChannelId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Example")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("InvalidTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsStatic")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PerDayLimit")
+ .HasColumnType("bigint");
+
+ b.Property("Sign")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("TemplateId")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("TemplateType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChannelId");
+
+ b.HasIndex("Code");
+
+ b.ToTable("MessageTemplates", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTemplates.Aggregates.MessageTemplateItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("nvarchar(64)");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("nvarchar(512)");
+
+ b.Property("DisplayText")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("MappingCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MessageTemplateId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("MessageTemplateId");
+
+ b.HasIndex("Code", "MessageTemplateId");
+
+ b.ToTable("MessageTemplateItems", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTemplates.Aggregates.SmsTemplate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AuditReason")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("AuditStatus")
+ .HasColumnType("int");
+
+ b.Property("ChannelId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TemplateCode")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("TemplateContent")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TemplateName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("TemplateType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChannelId");
+
+ b.ToTable("SmsTemplates", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.ReceiverGroups.Aggregates.ReceiverGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("ReceiverGroups", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.WebsiteMessages.Aggregates.WebsiteMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ChannelId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsRead")
+ .HasColumnType("bit");
+
+ b.Property("IsWithdrawn")
+ .HasColumnType("bit");
+
+ b.Property("LinkUrl")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("MessageTaskHistoryId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ReadTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("SendTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChannelId");
+
+ b.HasIndex("UserId", "ChannelId");
+
+ b.ToTable("WebsiteMessages", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.WebsiteMessages.Aggregates.WebsiteMessageCursor", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Creator")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("ModificationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Modifier")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UpdateTime")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("WebsiteMessageCursors", (string)null);
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.AppChannel", b =>
+ {
+ b.HasOne("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.Channel", null)
+ .WithOne()
+ .HasForeignKey("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.AppChannel", "Id")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageInfos.Aggregates.MessageInfo", b =>
+ {
+ b.OwnsOne("Masa.Mc.Service.Admin.Domain.MessageInfos.Aggregates.MessageContent", "MessageContent", b1 =>
+ {
+ b1.Property("MessageInfoId")
+ .HasColumnType("uniqueidentifier");
+
+ b1.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Content");
+
+ b1.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ExtraProperties");
+
+ b1.Property("IsJump")
+ .HasMaxLength(128)
+ .HasColumnType("bit")
+ .HasColumnName("IsJump");
+
+ b1.Property("JumpUrl")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)")
+ .HasColumnName("JumpUrl");
+
+ b1.Property("Markdown")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Markdown");
+
+ b1.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("nvarchar(128)")
+ .HasColumnName("Title");
+
+ b1.HasKey("MessageInfoId");
+
+ b1.ToTable("MessageInfos");
+
+ b1.WithOwner()
+ .HasForeignKey("MessageInfoId");
+ });
+
+ b.Navigation("MessageContent")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageRecords.Aggregates.MessageRecord", b =>
+ {
+ b.HasOne("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.AppChannel", "Channel")
+ .WithMany()
+ .HasForeignKey("ChannelId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Channel");
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageReceiverUser", b =>
+ {
+ b.HasOne("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTaskHistory", null)
+ .WithMany("ReceiverUsers")
+ .HasForeignKey("MessageTaskHistoryId");
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTask", b =>
+ {
+ b.HasOne("Masa.Mc.Service.Admin.Domain.Channels.Aggregates.AppChannel", "Channel")
+ .WithMany()
+ .HasForeignKey("ChannelId");
+
+ b.Navigation("Channel");
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTaskHistory", b =>
+ {
+ b.HasOne("Masa.Mc.Service.Admin.Domain.MessageTasks.Aggregates.MessageTask", "MessageTask")
+ .WithMany()
+ .HasForeignKey("MessageTaskId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("MessageTask");
+ });
+
+ modelBuilder.Entity("Masa.Mc.Service.Admin.Domain.MessageTemplates.Aggregates.MessageTemplate", b =>
+ {
+ b.OwnsOne("Masa.Mc.Service.Admin.Domain.MessageInfos.Aggregates.MessageContent", "MessageContent", b1 =>
+ {
+ b1.Property