From dc2aaa245f9487aa72c909c3da3d206922e97a76 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 3 Aug 2026 11:04:10 +0200 Subject: [PATCH] Add ResultType enum and Result property in ProfileHistory Introduced a new `ResultType` enum to represent job execution result types, including `Ok`, `Error`, `Warning`, and `Unknown`. Added a `Result` property in the `ProfileHistory` class as a wrapper around the `ResultId` property, with logic to map `ResultId` to `ResultType` values. Updated `ProfileHistory.cs` to include necessary namespaces. --- .../Entities/ProfileHistory.cs | 13 +++++++++ .../ValueObjects/ResultType.cs | 27 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 ECMJobRunner.Domain/ValueObjects/ResultType.cs diff --git a/ECMJobRunner.Domain/Entities/ProfileHistory.cs b/ECMJobRunner.Domain/Entities/ProfileHistory.cs index 7dd3304..a2c4ae9 100644 --- a/ECMJobRunner.Domain/Entities/ProfileHistory.cs +++ b/ECMJobRunner.Domain/Entities/ProfileHistory.cs @@ -1,3 +1,4 @@ +using ECMJobRunner.Domain.ValueObjects; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -35,6 +36,18 @@ namespace ECMJobRunner.Domain.Entities [Column("RESULT_ID")] public byte ResultId { get; set; } + /// + /// Gets or sets the result type of the job execution. + /// This property is not mapped to a database column; it wraps . + /// If does not correspond to a defined value, returns . + /// + [NotMapped] + public ResultType Result + { + get => Enum.IsDefined(typeof(ResultType), ResultId) ? (ResultType)ResultId : ResultType.Unknown; + set => ResultId = (byte)value; + } + /// /// Result text/message /// diff --git a/ECMJobRunner.Domain/ValueObjects/ResultType.cs b/ECMJobRunner.Domain/ValueObjects/ResultType.cs new file mode 100644 index 0000000..1919986 --- /dev/null +++ b/ECMJobRunner.Domain/ValueObjects/ResultType.cs @@ -0,0 +1,27 @@ +namespace ECMJobRunner.Domain.ValueObjects; + +/// +/// Represents the result type of a job execution. +/// +public enum ResultType : byte +{ + /// + /// The operation completed successfully. + /// + Ok = 0, + + /// + /// The operation encountered an error. + /// + Error = 1, + + /// + /// The operation completed with warnings. + /// + Warning = 2, + + /// + /// The operation result is unknown. + /// + Unknown = 255 +}