Refactor constants and update CreateHistoryCommand
Updated `CreateHistoryCommand.cs` to use the `EnvelopeStatus` enum directly from the `EnvelopeGenerator.Domain.Constants` namespace. Refactored `Constants.cs` to consolidate multiple enums related to statuses, types, and roles. Modified `Fake.cs` to align with the new enum structure and introduced `Value.cs` for better organization of constant string values. Overall, these changes enhance code clarity and maintainability.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
using EnvelopeGenerator.Application.Model;
|
using EnvelopeGenerator.Application.Model;
|
||||||
using EnvelopeGenerator.Domain;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using EnvelopeGenerator.Application.Extensions;
|
using EnvelopeGenerator.Application.Extensions;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Histories.Commands;
|
namespace EnvelopeGenerator.Application.Histories.Commands;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public record CreateHistoryCommand : EnvelopeReceiverQueryBase, IRequest<long?>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Constants.EnvelopeStatus Status { get; set; }
|
public EnvelopeStatus Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
#if NETFRAMEWORK
|
|
||||||
using System.Collections.Generic;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain
|
|
||||||
{
|
|
||||||
public static class Constants
|
|
||||||
{
|
|
||||||
#region Status Fields
|
|
||||||
|
|
||||||
// http://wiki.dd/xwiki13/bin/view/Anwendungen/Produkt-Handbuch/Sonstiges/SignFlow/Envelope%20Status/
|
|
||||||
public enum EnvelopeStatus
|
|
||||||
{
|
|
||||||
Invalid = 0,
|
|
||||||
EnvelopeCreated = 1001,
|
|
||||||
EnvelopeSaved = 1002,
|
|
||||||
EnvelopeQueued = 1003,
|
|
||||||
EnvelopeSent = 1004, // Nicht verwendet
|
|
||||||
EnvelopePartlySigned = 1005,
|
|
||||||
EnvelopeCompletelySigned = 1006,
|
|
||||||
EnvelopeReportCreated = 1007,
|
|
||||||
EnvelopeArchived = 1008,
|
|
||||||
EnvelopeDeleted = 1009,
|
|
||||||
EnvelopeRejected = 10007,
|
|
||||||
EnvelopeWithdrawn = 10009,
|
|
||||||
AccessCodeRequested = 2001,
|
|
||||||
AccessCodeCorrect = 2002,
|
|
||||||
AccessCodeIncorrect = 2003,
|
|
||||||
DocumentOpened = 2004,
|
|
||||||
DocumentSigned = 2005,
|
|
||||||
DocumentForwarded = 2006,
|
|
||||||
DocumentRejected = 2007,
|
|
||||||
EnvelopeShared = 2008,
|
|
||||||
EnvelopeViewed = 2009,
|
|
||||||
MessageInvitationSent = 3001, // Wird von Trigger verwendet
|
|
||||||
MessageAccessCodeSent = 3002,
|
|
||||||
MessageConfirmationSent = 3003,
|
|
||||||
MessageDeletionSent = 3004,
|
|
||||||
MessageCompletionSent = 3005,
|
|
||||||
DocumentMod_Rotation = 4001
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Status
|
|
||||||
{
|
|
||||||
public static readonly IReadOnlyList<EnvelopeStatus> NonHist = new List<EnvelopeStatus>
|
|
||||||
{
|
|
||||||
EnvelopeStatus.Invalid,
|
|
||||||
EnvelopeStatus.EnvelopeSaved,
|
|
||||||
EnvelopeStatus.EnvelopeSent,
|
|
||||||
EnvelopeStatus.EnvelopePartlySigned
|
|
||||||
};
|
|
||||||
|
|
||||||
public static readonly IReadOnlyList<EnvelopeStatus> RelatedToFormApp = new List<EnvelopeStatus>
|
|
||||||
{
|
|
||||||
EnvelopeStatus.EnvelopeCreated,
|
|
||||||
EnvelopeStatus.DocumentMod_Rotation
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: standardize in xwiki
|
|
||||||
public enum ReferenceType
|
|
||||||
{
|
|
||||||
Sender = 1,
|
|
||||||
Receiver,
|
|
||||||
System,
|
|
||||||
Unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ElementStatus
|
|
||||||
{
|
|
||||||
Created = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum DocumentStatus
|
|
||||||
{
|
|
||||||
Created = 0,
|
|
||||||
Signed = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ReceiverStatus
|
|
||||||
{
|
|
||||||
Unsigned = 0,
|
|
||||||
Signed = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Type Fields
|
|
||||||
|
|
||||||
public enum ElementType
|
|
||||||
{
|
|
||||||
Signature = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ColorType
|
|
||||||
{
|
|
||||||
ReceiverColor1 = 1,
|
|
||||||
ReceiverColor2 = 2,
|
|
||||||
ReceiverColor3 = 3,
|
|
||||||
ReceiverColor4 = 4,
|
|
||||||
ReceiverColor5 = 5,
|
|
||||||
ReceiverColor6 = 6,
|
|
||||||
ReceiverColor7 = 7,
|
|
||||||
ReceiverColor8 = 8,
|
|
||||||
ReceiverColor9 = 9,
|
|
||||||
ReceiverColor10 = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CertificationType
|
|
||||||
{
|
|
||||||
AdvancedElectronicSignature = 1
|
|
||||||
// ElectronicSignature = 1
|
|
||||||
// QualifiedSignature = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum FinalEmailType
|
|
||||||
{
|
|
||||||
No = 0,
|
|
||||||
Yes = 1,
|
|
||||||
YesWithAttachment = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum EmailTemplateType
|
|
||||||
{
|
|
||||||
DocumentReceived = 0,
|
|
||||||
DocumentSigned,
|
|
||||||
DocumentDeleted,
|
|
||||||
DocumentCompleted,
|
|
||||||
DocumentAccessCodeReceived,
|
|
||||||
DocumentShared,
|
|
||||||
TotpSecret,
|
|
||||||
DocumentRejected_ADM,
|
|
||||||
DocumentRejected_REC,
|
|
||||||
DocumentRejected_REC_2
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum EncodeType
|
|
||||||
{
|
|
||||||
EnvelopeReceiver,
|
|
||||||
EnvelopeReceiverReadOnly,
|
|
||||||
Undefined,
|
|
||||||
DocumentForwarded,
|
|
||||||
DocumentShared
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Role
|
|
||||||
|
|
||||||
public static class ReceiverRole
|
|
||||||
{
|
|
||||||
public const string PreAuth = "PreAuth";
|
|
||||||
public const string FullyAuth = "FullyAuth";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constants
|
|
||||||
|
|
||||||
public const string DATABASE = "DATABASE";
|
|
||||||
public const string LOGCONFIG = "LOGCONFIG";
|
|
||||||
public const string GDPICTURE = "GDPICTURE";
|
|
||||||
public const string PDF_BURNER_PARAMS = "PDFBurnerParams";
|
|
||||||
|
|
||||||
public const string GREEN_300 = "#bbf7d0";
|
|
||||||
public const string RED_300 = "#fecaca";
|
|
||||||
public const string ORANGE_300 = "#fed7aa";
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
9
EnvelopeGenerator.Domain/Constants/CertificationType.cs
Normal file
9
EnvelopeGenerator.Domain/Constants/CertificationType.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum CertificationType
|
||||||
|
{
|
||||||
|
AdvancedElectronicSignature = 1
|
||||||
|
// ElectronicSignature = 1
|
||||||
|
// QualifiedSignature = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
16
EnvelopeGenerator.Domain/Constants/ColorType.cs
Normal file
16
EnvelopeGenerator.Domain/Constants/ColorType.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum ColorType
|
||||||
|
{
|
||||||
|
ReceiverColor1 = 1,
|
||||||
|
ReceiverColor2 = 2,
|
||||||
|
ReceiverColor3 = 3,
|
||||||
|
ReceiverColor4 = 4,
|
||||||
|
ReceiverColor5 = 5,
|
||||||
|
ReceiverColor6 = 6,
|
||||||
|
ReceiverColor7 = 7,
|
||||||
|
ReceiverColor8 = 8,
|
||||||
|
ReceiverColor9 = 9,
|
||||||
|
ReceiverColor10 = 10
|
||||||
|
}
|
||||||
|
}
|
||||||
8
EnvelopeGenerator.Domain/Constants/DocumentStatus.cs
Normal file
8
EnvelopeGenerator.Domain/Constants/DocumentStatus.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum DocumentStatus
|
||||||
|
{
|
||||||
|
Created = 0,
|
||||||
|
Signed = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
7
EnvelopeGenerator.Domain/Constants/ElementStatus.cs
Normal file
7
EnvelopeGenerator.Domain/Constants/ElementStatus.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum ElementStatus
|
||||||
|
{
|
||||||
|
Created = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
7
EnvelopeGenerator.Domain/Constants/ElementType.cs
Normal file
7
EnvelopeGenerator.Domain/Constants/ElementType.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum ElementType
|
||||||
|
{
|
||||||
|
Signature = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
16
EnvelopeGenerator.Domain/Constants/EmailTemplateType.cs
Normal file
16
EnvelopeGenerator.Domain/Constants/EmailTemplateType.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum EmailTemplateType
|
||||||
|
{
|
||||||
|
DocumentReceived = 0,
|
||||||
|
DocumentSigned,
|
||||||
|
DocumentDeleted,
|
||||||
|
DocumentCompleted,
|
||||||
|
DocumentAccessCodeReceived,
|
||||||
|
DocumentShared,
|
||||||
|
TotpSecret,
|
||||||
|
DocumentRejected_ADM,
|
||||||
|
DocumentRejected_REC,
|
||||||
|
DocumentRejected_REC_2
|
||||||
|
}
|
||||||
|
}
|
||||||
11
EnvelopeGenerator.Domain/Constants/EncodeType.cs
Normal file
11
EnvelopeGenerator.Domain/Constants/EncodeType.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum EncodeType
|
||||||
|
{
|
||||||
|
EnvelopeReceiver,
|
||||||
|
EnvelopeReceiverReadOnly,
|
||||||
|
Undefined,
|
||||||
|
DocumentForwarded,
|
||||||
|
DocumentShared
|
||||||
|
}
|
||||||
|
}
|
||||||
53
EnvelopeGenerator.Domain/Constants/EnvelopeStatus.cs
Normal file
53
EnvelopeGenerator.Domain/Constants/EnvelopeStatus.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
// http://wiki.dd/xwiki13/bin/view/Anwendungen/Produkt-Handbuch/Sonstiges/SignFlow/Envelope%20Status/
|
||||||
|
public enum EnvelopeStatus
|
||||||
|
{
|
||||||
|
Invalid = 0,
|
||||||
|
EnvelopeCreated = 1001,
|
||||||
|
EnvelopeSaved = 1002,
|
||||||
|
EnvelopeQueued = 1003,
|
||||||
|
EnvelopeSent = 1004, // Nicht verwendet
|
||||||
|
EnvelopePartlySigned = 1005,
|
||||||
|
EnvelopeCompletelySigned = 1006,
|
||||||
|
EnvelopeReportCreated = 1007,
|
||||||
|
EnvelopeArchived = 1008,
|
||||||
|
EnvelopeDeleted = 1009,
|
||||||
|
EnvelopeRejected = 10007,
|
||||||
|
EnvelopeWithdrawn = 10009,
|
||||||
|
AccessCodeRequested = 2001,
|
||||||
|
AccessCodeCorrect = 2002,
|
||||||
|
AccessCodeIncorrect = 2003,
|
||||||
|
DocumentOpened = 2004,
|
||||||
|
DocumentSigned = 2005,
|
||||||
|
DocumentForwarded = 2006,
|
||||||
|
DocumentRejected = 2007,
|
||||||
|
EnvelopeShared = 2008,
|
||||||
|
EnvelopeViewed = 2009,
|
||||||
|
MessageInvitationSent = 3001, // Wird von Trigger verwendet
|
||||||
|
MessageAccessCodeSent = 3002,
|
||||||
|
MessageConfirmationSent = 3003,
|
||||||
|
MessageDeletionSent = 3004,
|
||||||
|
MessageCompletionSent = 3005,
|
||||||
|
DocumentMod_Rotation = 4001
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Status
|
||||||
|
{
|
||||||
|
public static readonly IReadOnlyList<EnvelopeStatus> NonHist = new List<EnvelopeStatus>
|
||||||
|
{
|
||||||
|
EnvelopeStatus.Invalid,
|
||||||
|
EnvelopeStatus.EnvelopeSaved,
|
||||||
|
EnvelopeStatus.EnvelopeSent,
|
||||||
|
EnvelopeStatus.EnvelopePartlySigned
|
||||||
|
};
|
||||||
|
|
||||||
|
public static readonly IReadOnlyList<EnvelopeStatus> RelatedToFormApp = new List<EnvelopeStatus>
|
||||||
|
{
|
||||||
|
EnvelopeStatus.EnvelopeCreated,
|
||||||
|
EnvelopeStatus.DocumentMod_Rotation
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EnvelopeGenerator.Domain/Constants/FinalEmailType.cs
Normal file
9
EnvelopeGenerator.Domain/Constants/FinalEmailType.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum FinalEmailType
|
||||||
|
{
|
||||||
|
No = 0,
|
||||||
|
Yes = 1,
|
||||||
|
YesWithAttachment = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
8
EnvelopeGenerator.Domain/Constants/ReceiverRole.cs
Normal file
8
EnvelopeGenerator.Domain/Constants/ReceiverRole.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public static class ReceiverRole
|
||||||
|
{
|
||||||
|
public const string PreAuth = "PreAuth";
|
||||||
|
public const string FullyAuth = "FullyAuth";
|
||||||
|
}
|
||||||
|
}
|
||||||
8
EnvelopeGenerator.Domain/Constants/ReceiverStatus.cs
Normal file
8
EnvelopeGenerator.Domain/Constants/ReceiverStatus.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public enum ReceiverStatus
|
||||||
|
{
|
||||||
|
Unsigned = 0,
|
||||||
|
Signed = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
11
EnvelopeGenerator.Domain/Constants/ReferenceType.cs
Normal file
11
EnvelopeGenerator.Domain/Constants/ReferenceType.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
// TODO: standardize in xwiki
|
||||||
|
public enum ReferenceType
|
||||||
|
{
|
||||||
|
Sender = 1,
|
||||||
|
Receiver,
|
||||||
|
System,
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
|
}
|
||||||
14
EnvelopeGenerator.Domain/Constants/Value.cs
Normal file
14
EnvelopeGenerator.Domain/Constants/Value.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace EnvelopeGenerator.Domain.Constants
|
||||||
|
{
|
||||||
|
public static class Value
|
||||||
|
{
|
||||||
|
public const string DATABASE = "DATABASE";
|
||||||
|
public const string LOGCONFIG = "LOGCONFIG";
|
||||||
|
public const string GDPICTURE = "GDPICTURE";
|
||||||
|
public const string PDF_BURNER_PARAMS = "PDFBurnerParams";
|
||||||
|
|
||||||
|
public const string GREEN_300 = "#bbf7d0";
|
||||||
|
public const string RED_300 = "#fecaca";
|
||||||
|
public const string ORANGE_300 = "#fed7aa";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using QuestPDF.Fluent;
|
using QuestPDF.Fluent;
|
||||||
using QuestPDF.Infrastructure;
|
using QuestPDF.Infrastructure;
|
||||||
using EnvelopeGenerator.Domain;
|
using EnvelopeGenerator.Domain;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Tests.Application;
|
namespace EnvelopeGenerator.Tests.Application;
|
||||||
|
|
||||||
@@ -204,13 +205,13 @@ public static class Extensions
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region History
|
#region History
|
||||||
public static CreateHistoryCommand CreateHistoryCommand<TEnvelopeQuery, TReceiverQuery>(this Faker fake, string key, Constants.EnvelopeStatus? status = null)
|
public static CreateHistoryCommand CreateHistoryCommand<TEnvelopeQuery, TReceiverQuery>(this Faker fake, string key, EnvelopeStatus? status = null)
|
||||||
where TEnvelopeQuery : EnvelopeQueryBase
|
where TEnvelopeQuery : EnvelopeQueryBase
|
||||||
where TReceiverQuery : ReceiverQueryBase
|
where TReceiverQuery : ReceiverQueryBase
|
||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Status = status ?? fake.PickEnum<Constants.EnvelopeStatus>(),
|
Status = status ?? fake.PickEnum<EnvelopeStatus>(),
|
||||||
Comment = fake.Lorem.Sentence(),
|
Comment = fake.Lorem.Sentence(),
|
||||||
Key = key,
|
Key = key,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user