Skip to content

Commit fb1369f

Browse files
authored
Merge pull request #18 from deveel/16-consider-alternatives-for-the-mongo-data-layer
MongoDB Data Layer Rewrite
2 parents 39514b8 + 8b71774 commit fb1369f

File tree

124 files changed

+5720
-2657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+5720
-2657
lines changed

.idea/.idea.Deveel.Webhooks/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Deveel.Webhooks/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Deveel.Webhooks/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Deveel.Webhooks/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Deveel.Webhooks/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Deveel.Webhooks.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Deveel.Webhooks.Sender.Newt
3535
EndProject
3636
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Deveel.Webhooks.Signers", "src\Deveel.Webhooks.Signers\Deveel.Webhooks.Signers.csproj", "{6D6057E9-117F-4B13-80E7-4C18B3905AEB}"
3737
EndProject
38-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deveel.Webhooks.MongoDb.XUnit", "test\Deveel.Webhooks.MongoDb.XUnit\Deveel.Webhooks.MongoDb.XUnit.csproj", "{D61BAD7A-7B8A-4413-A0D0-8F52EE81A0B0}"
38+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Deveel.Webhooks.MongoDb.XUnit", "test\Deveel.Webhooks.MongoDb.XUnit\Deveel.Webhooks.MongoDb.XUnit.csproj", "{D61BAD7A-7B8A-4413-A0D0-8F52EE81A0B0}"
3939
EndProject
4040
Global
4141
GlobalSection(SolutionConfigurationPlatforms) = preSolution

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "7.0.0",
4+
"rollForward": "latestMajor",
5+
"allowPrerelease": true
6+
}
7+
}

src/Deveel.Webhooks.DynamicLinq/Webhooks/LinqWebhookFilterEvaluator.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private Func<object, bool> Compile(Type objType, string filter) {
3838
Expression.Parameter(objType, "hook")
3939
};
4040
var parsed = DynamicExpressionParser.ParseLambda(config, parameters, typeof(bool), filter).Compile();
41-
compiled = hook => (bool)parsed.DynamicInvoke(hook);
41+
compiled = hook => (bool)(parsed.DynamicInvoke(hook)!);
4242
filterCache[filter] = compiled;
4343
}
4444

@@ -66,19 +66,26 @@ public async Task<bool> MatchesAsync(WebhookSubscriptionFilter filter, TWebhook
6666
if (filter.IsWildcard)
6767
return true;
6868

69-
var obj = await jsonSerializer.SerializeToObjectAsync(webhook, cancellationToken);
69+
try {
70+
var obj = await jsonSerializer.SerializeToObjectAsync(webhook, cancellationToken);
7071

71-
if (obj is null)
72-
return false;
72+
if (obj is null)
73+
return false;
7374

74-
var evalFilter = Compile(obj.GetType(), filter.Filters);
75+
var evalFilter = Compile(obj.GetType(), filter.Filters);
7576

76-
if (evalFilter == null)
77-
return false;
77+
if (evalFilter == null)
78+
return false;
7879

79-
var result = evalFilter(obj);
80+
var result = evalFilter(obj);
81+
82+
return result;
83+
} catch (WebhookSerializationException ex) {
84+
throw new WebhookException("The webhook object is invalid", ex);
85+
} catch(Exception ex) {
86+
throw new WebhookException("Unable to evaluate the filter", ex);
87+
}
8088

81-
return result;
8289
}
8390
}
8491
}

src/Deveel.Webhooks.Model/Webhooks/IWebhook.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@ public interface IWebhook {
2626
/// </summary>
2727
string Id { get; }
2828

29-
/// <summary>
30-
/// If the webhook was originated by a subscription,
31-
/// this gets its unique identifier.
32-
/// </summary>
33-
string? SubscriptionId { get; }
34-
35-
/// <summary>
36-
/// If the webhook was originated by a subscription,
37-
/// this is its name.
38-
/// </summary>
39-
string? SubscriptionName { get; }
40-
4129
/// <summary>
4230
/// Gets the exact time of the event occurrence.
4331
/// </summary>

src/Deveel.Webhooks.Model/Webhooks/IWebhookDeliveryAttempt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Deveel.Webhooks {
1818
public interface IWebhookDeliveryAttempt {
1919
int? ResponseStatusCode { get; }
2020

21-
string ResponseMessage { get; }
21+
string? ResponseMessage { get; }
2222

2323
DateTimeOffset StartedAt { get; }
2424

0 commit comments

Comments
 (0)