Skip to content

Commit

Permalink
Merge pull request #68 from Worth-NL/fix/DecisionScenario_PublishingO…
Browse files Browse the repository at this point in the history
…bject_WrongJSON

Fix/decision scenario publishing object wrong json
  • Loading branch information
Thomas-M-Krystyan authored Sep 19, 2024
2 parents 3837187 + 346079b commit 4a0467d
Show file tree
Hide file tree
Showing 41 changed files with 686 additions and 383 deletions.
19 changes: 13 additions & 6 deletions Documentation/OMC - Documentation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# **OMC** Documentation

v.1.8.15
v.1.8.16

© 2024, Worth Systems.

Expand Down Expand Up @@ -135,14 +135,14 @@ And all of them have **Swagger UI** specified as the default start option.
"USER_TEMPLATEIDS_EMAIL_ZAAKUPDATE": "",
"USER_TEMPLATEIDS_EMAIL_ZAAKCLOSE": "",
"USER_TEMPLATEIDS_EMAIL_TASKASSIGNED": "",
// NOTE: "DecisionMade" scenario is not sending notifications; it doesn't have a dedicatged template IDs
"USER_TEMPLATEIDS_EMAIL_DECISIONMADE": "",
"USER_TEMPLATEIDS_EMAIL_MESSAGERECEIVED": "",

"USER_TEMPLATEIDS_SMS_ZAAKCREATE": "",
"USER_TEMPLATEIDS_SMS_ZAAKUPDATE": "",
"USER_TEMPLATEIDS_SMS_ZAAKCLOSE": "",
"USER_TEMPLATEIDS_SMS_TASKASSIGNED": "",
// NOTE: "DecisionMade" scenario is not sending notifications; it doesn't have a dedicatged template IDs
"USER_TEMPLATEIDS_SMS_DECISIONMADE": "",
"USER_TEMPLATEIDS_SMS_MESSAGERECEIVED": "",

"USER_WHITELIST_ZAAKCREATE_IDS": "",
Expand All @@ -152,7 +152,10 @@ And all of them have **Swagger UI** specified as the default start option.
"USER_WHITELIST_DECISIONMADE_IDS": "",
"USER_WHITELIST_MESSAGE_ALLOWED": "false",
"USER_WHITELIST_TASKOBJECTTYPE_UUID": "",
"USER_WHITELIST_MESSAGEOBJECTTYPE_UUIDS": "",
"USER_WHITELIST_MESSAGEOBJECTTYPE_UUID": "",
"USER_WHITELIST_DECISIONINFOOBJECTTYPE_UUIDS": "",

"USER_VARIABLES_OBJECTEN_MESSAGEOBJECTTYPE_VERSION" : "",

"SENTRY_DSN": "",
"SENTRY_ENVIRONMENT": "Worth Systems (Development)" // NOTE: Optional place to reflect application instance and mode
Expand Down Expand Up @@ -284,7 +287,7 @@ but `environment variables` are easier to be adjusted by the end users of **OMC*
},

"Objecten": {
"MessageObjectType_Version": 13,
"MessageObjectType_Version": 1,
"MessageObjectType_Name": "Logius"
},

Expand Down Expand Up @@ -382,7 +385,11 @@ During the start of the **OMC** application the content of `appsettings.[ASPNETC
| USER_WHITELIST_DECISIONMADE_IDS | string[] | "1, 2, 3, 4" or "*" (allow everything) | false | | Is provided by the user based on "Identificatie" property of case type retrieved from case URI ("zaak") from "OpenZaak" Web API service |
| USER_WHITELIST_MESSAGE_ALLOWED | bool | "true" or "false" | false | Cannot be missing and have null or empty value | Is provided by the user |
| USER_WHITELIST_TASKOBJECTTYPE_UUID | GUID | "00000000-0000-0000-0000-000000000000" | false | Cannot be missing and have null or empty value + must be in UUID format | Is provided by the user based on "objectType" from "kenmerken" from the initial notification received from "Notificaties" Web API service |
| USER_WHITELIST_MESSAGEOBJECTTYPE_UUIDS | GUID[] | "00000000-0000-..., 00000000-0000-..." | false | Cannot be missing and have null or empty value + must be in UUID format | Is provided by the user based on "informatieobjecttype" from "informatieobject" retrieved from "OpenZaak" Web API service when querying "besluiten" |
| USER_WHITELIST_MESSAGEOBJECTTYPE_UUID | GUID | "00000000-0000-0000-0000-000000000000" | false | Cannot be missing and have null or empty value + must be in UUID format | Is provided by the user based on "objectType" from "kenmerken" from the initial notification received from "Notificaties" Web API service |
| USER_WHITELIST_DECISIONINFOOBJECTTYPE_UUIDS | GUID[] | "00000000-0000-..., 00000000-0000-..." | false | Cannot be missing and have null or empty value + must be in UUID format | Is provided by the user based on "informatieobjecttype" from "informatieobject" retrieved from "OpenZaak" Web API service when querying "besluiten" |
| --- | --- | --- | --- | --- | --- |
| **Variables:** Used by "OMC" Web API | | | | | |
| USER_VARIABLES_OBJECTEN_MESSAGEOBJECTTYPE_VERSION | ushort | "1" | false | Cannot be missing and have null or empty value | It can be taken from "version" value set in "ObjectTypen" Web API service |
| --- | --- | --- | --- | --- | --- |
| **Monitoring:** Configurations used by "Sentry" | | | | | |
| SENTRY_DSN | URI | "https://1abxxx@o1xxx.sentry.io/xxx" | false | Validated internally by Sentry.SDK | It points out to the Sentry project configured to store captured events from the app (messages, exceptions) |
Expand Down
2 changes: 1 addition & 1 deletion EventsHandler/Api/EventsHandler/Constants/DefaultValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class ApiController
{
internal const string Route = "[controller]";

internal const string Version = "1.815";
internal const string Version = "1.816";
}
#endregion

Expand Down
35 changes: 35 additions & 0 deletions EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// © 2024, Worth Systems.

using System.Globalization;

namespace EventsHandler.Extensions
{
/// <summary>
/// Extension methods for <see cref="DateTime"/>s.
/// </summary>
internal static class DateTimeExtensions
{
private static readonly TimeZoneInfo s_cetTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
private static readonly CultureInfo s_dutchCulture = new("nl-NL");

/// <summary>
/// Converts the given <see cref="DateTime"/> into a <see langword="string"/> representation of the local (Dutch) date.
/// </summary>
/// <param name="dateTime">The source date time.</param>
/// <returns>
/// The <see langword="string"/> representation of a date in the following format:
/// <code>2024-09-15</code>
/// </returns>
internal static string ConvertToDutchDateString(this DateTime dateTime)
{
// Convert time zone from UTC to CET (if necessary)
if (dateTime.Kind == DateTimeKind.Utc)
{
dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, s_cetTimeZone);
}

// Formatting the date and time
return dateTime.ToString("yyyy-MM-dd", s_dutchCulture);
}
}
}
40 changes: 40 additions & 0 deletions EventsHandler/Api/EventsHandler/Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using EventsHandler.Mapping.Enums.NotifyNL;
using EventsHandler.Services.DataProcessing.Enums;
using EventsHandler.Services.Responding.Enums.v2;
using System.Collections.Concurrent;
using System.Reflection;
using System.Text.Json.Serialization;

namespace EventsHandler.Extensions
{
Expand All @@ -12,6 +15,43 @@ namespace EventsHandler.Extensions
/// </summary>
internal static class EnumExtensions
{
private static readonly ConcurrentDictionary<Enum, string> s_cachedEnumOptionNames = new();

/// <summary>
/// Gets the name of the <typeparamref name="TEnum"/> option.
/// </summary>
/// <typeparam name="TEnum">The type of the enum.</typeparam>
/// <param name="enum">The enum option.</param>
/// <returns>
/// The custom name of the given <typeparamref name="TEnum"/> option defined in attributes
/// or the default enum option name if the expected attributes are not existing.
/// </returns>
internal static string GetEnumName<TEnum>(this TEnum @enum)
where TEnum : struct, Enum
{
return s_cachedEnumOptionNames.GetOrAdd(
key: @enum,
value: ExtractCustomEnumOptionName(@enum));

static string ExtractCustomEnumOptionName(TEnum @enum)
{
string enumOptionName = @enum.ToString();

string jsonPropertyName =
// Case #1: The name from JsonPropertyName attribute can be retrieved
typeof(TEnum).GetMember(enumOptionName).FirstOrDefault()? // The enum option is defined in the given enum
.GetCustomAttribute<JsonPropertyNameAttribute>()? // The attribute JsonPropertyName is existing
.Name
// Case #2: The name from JsonPropertyName attribute cannot be retrieved
?? enumOptionName;

return !string.IsNullOrWhiteSpace(jsonPropertyName)
? jsonPropertyName
// Case #3: The name from JsonPropertyName attribute is empty or contains only white characters
: enumOptionName;
}
}

/// <summary>
/// Converts from <see cref="ProcessingResult"/> enum to <see cref="LogLevel"/> enum.
/// </summary>
Expand Down
48 changes: 24 additions & 24 deletions EventsHandler/Api/EventsHandler/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a0467d

Please sign in to comment.