Changes: - Remove deprecated Fengling.Activity and YarpGateway.Admin projects - Add points processing services with distributed lock support - Update Vben frontend with gateway management pages - Add gateway config controller and database listener - Update routing to use header-mixed-nav layout - Add comprehensive test suites for Member services - Add YarpGateway integration tests - Update package versions in Directory.Packages.props Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
42 lines
1.6 KiB
C#
42 lines
1.6 KiB
C#
namespace Fengling.Activity.Domain.ValueObjects;
|
|
|
|
public class ConditionConfig : IEquatable<ConditionConfig>
|
|
{
|
|
public string StrategyType { get; }
|
|
public IReadOnlyDictionary<string, object> Parameters { get; }
|
|
|
|
private ConditionConfig(string strategyType, Dictionary<string, object> parameters)
|
|
{
|
|
StrategyType = strategyType;
|
|
Parameters = parameters;
|
|
}
|
|
|
|
public static ConditionConfig Create(string strategyType, Dictionary<string, object> parameters)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(strategyType))
|
|
throw new ArgumentException("Strategy type cannot be empty");
|
|
return new ConditionConfig(strategyType, parameters);
|
|
}
|
|
|
|
public T? GetParameter<T>(string key)
|
|
{
|
|
if (Parameters.TryGetValue(key, out var value) && value is T typedValue)
|
|
return typedValue;
|
|
return default;
|
|
}
|
|
|
|
public bool Equals(ConditionConfig? other)
|
|
{
|
|
if (other is null) return false;
|
|
if (StrategyType != other.StrategyType) return false;
|
|
return Parameters.Count == other.Parameters.Count &&
|
|
Parameters.All(p => other.Parameters.TryGetValue(p.Key, out var ov) &&
|
|
(p.Value?.Equals(ov) ?? ov is null));
|
|
}
|
|
|
|
public override bool Equals(object? obj) => Equals(obj as ConditionConfig);
|
|
public override int GetHashCode() => HashCode.Combine(StrategyType, Parameters);
|
|
public static bool operator ==(ConditionConfig a, ConditionConfig b) => a.Equals(b);
|
|
public static bool operator !=(ConditionConfig a, ConditionConfig b) => !a.Equals(b);
|
|
}
|