< Summary

Information
Class: Elsa.UserTasks.Persistence.EFCore.UserTaskGuestSessionRecord
Assembly: Elsa.UserTasks.Persistence.EFCore
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.UserTasks.Persistence.EFCore/PersistenceModels.cs
Line coverage
90%
Covered lines: 9
Uncovered lines: 1
Coverable lines: 10
Total lines: 218
Line coverage: 90%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_TenantId()100%11100%
get_TaskId()100%11100%
get_InvitationId()100%11100%
get_SessionTokenHash()100%11100%
get_GuestParticipantJson()100%11100%
get_CapabilitiesJson()100%11100%
get_IssuedAt()100%11100%
get_ExpiresAt()100%11100%
get_RevokedAt()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.UserTasks.Persistence.EFCore/PersistenceModels.cs

#LineLine coverage
 1using Elsa.UserTasks.Models;
 2
 3namespace Elsa.UserTasks.Persistence.EFCore;
 4
 5/// <summary>
 6/// EF records intentionally keep JSON payloads and participant references flattened so every relational
 7/// provider has the same schema. The public User Tasks aggregate is materialized by the repository.
 8/// </summary>
 9public enum UserTaskPersistenceCandidateSource
 10{
 11    DirectUser,
 12    DirectGroup,
 13    SnapshotMember,
 14    Invitation
 15}
 16
 17public sealed class UserTaskRecord
 18{
 19    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 20    public string TenantId { get; set; } = default!;
 21    public string WorkflowDefinitionId { get; set; } = default!;
 22    public string? WorkflowDefinitionName { get; set; }
 23    public int? WorkflowDefinitionVersion { get; set; }
 24    public string WorkflowInstanceId { get; set; } = default!;
 25    public string? WorkflowInstanceReference { get; set; }
 26    public string ActivityInstanceId { get; set; } = default!;
 27    public string BookmarkId { get; set; } = default!;
 28    public string MaterializationKey { get; set; } = default!;
 29    public string Title { get; set; } = default!;
 30    public string? Summary { get; set; }
 31    public string? Reference { get; set; }
 32    public string? TaskType { get; set; }
 33    public string TagsJson { get; set; } = "[]";
 34    public string? RequesterProvider { get; set; }
 35    public string? RequesterType { get; set; }
 36    public string? RequesterId { get; set; }
 37    public string? RequesterDisplayName { get; set; }
 38    public int Priority { get; set; } = 50;
 39    public DateTimeOffset? DueAt { get; set; }
 40    public bool IsOverdue { get; set; }
 41    public UserTaskStatus Status { get; set; }
 42    public bool TimeoutEnabled { get; set; }
 43    public bool CancellationEnabled { get; set; }
 44    public bool AllowManagerExclusionOverride { get; set; }
 45    public UserTaskMembershipResolutionMode? MembershipResolutionMode { get; set; }
 46    public string? AssigneeProvider { get; set; }
 47    public string? AssigneeType { get; set; }
 48    public string? AssigneeId { get; set; }
 49    public string? AssigneeDisplayName { get; set; }
 50    public string InstructionsJson { get; set; } = "null";
 51    public string TaskDataJson { get; set; } = "null";
 52    public string? FormReferenceJson { get; set; }
 53    public string? PinnedFormJson { get; set; }
 54    public string? ActionsJson { get; set; }
 55    public string InvitationDefinitionsJson { get; set; } = "[]";
 56    public string HealthIssuesJson { get; set; } = "[]";
 57    public UserTaskHealthSeverity? HealthSeverity { get; set; }
 58    public string? HealthCode { get; set; }
 59    public string? HealthMessage { get; set; }
 60    public string? CompletionActionKey { get; set; }
 61    public string? CompletionDataJson { get; set; }
 62    public string? CompletionActorJson { get; set; }
 63    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 64    public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
 65    public DateTimeOffset? AssignedAt { get; set; }
 66    public DateTimeOffset? CompletedAt { get; set; }
 67    public int Revision { get; set; }
 68    public long? CreatedFromBookmarkRevision { get; set; }
 69}
 70
 71public sealed class UserTaskCandidateRecord
 72{
 73    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 74    public string TenantId { get; set; } = default!;
 75    public string TaskId { get; set; } = default!;
 76    public string Provider { get; set; } = default!;
 77    public string ParticipantKey { get; set; } = default!;
 78    public UserTaskParticipantType ParticipantType { get; set; }
 79    public string ParticipantId { get; set; } = default!;
 80    public string? DisplayName { get; set; }
 81    public UserTaskPersistenceCandidateSource Source { get; set; }
 82    public string? SourceGroupProvider { get; set; }
 83    public string? SourceGroupId { get; set; }
 84    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 85    public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
 86}
 87
 88public sealed class UserTaskSnapshotMemberRecord
 89{
 90    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 91    public string TenantId { get; set; } = default!;
 92    public string TaskId { get; set; } = default!;
 93    public string Provider { get; set; } = default!;
 94    public string ParticipantKey { get; set; } = default!;
 95    public UserTaskParticipantType ParticipantType { get; set; } = UserTaskParticipantType.User;
 96    public string ParticipantId { get; set; } = default!;
 97    public string? SourceGroupProvider { get; set; }
 98    public string? SourceGroupId { get; set; }
 99    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 100}
 101
 102public sealed class UserTaskExclusionRecord
 103{
 104    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 105    public string TenantId { get; set; } = default!;
 106    public string TaskId { get; set; } = default!;
 107    public string Provider { get; set; } = default!;
 108    public string ParticipantKey { get; set; } = default!;
 109    public UserTaskParticipantType ParticipantType { get; set; } = UserTaskParticipantType.User;
 110    public string ParticipantId { get; set; } = default!;
 111    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 112}
 113
 114public sealed class UserTaskEventRecord
 115{
 116    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 117    public string TenantId { get; set; } = default!;
 118    public string TaskId { get; set; } = default!;
 119    public int Revision { get; set; }
 120    public string EventType { get; set; } = default!;
 121    public DateTimeOffset OccurredAt { get; set; } = DateTimeOffset.UtcNow;
 122    public string? OperationId { get; set; }
 123    public string? ActorProvider { get; set; }
 124    public string? ActorType { get; set; }
 125    public string? ActorId { get; set; }
 126    public string? ActorJson { get; set; }
 127    public string? Reason { get; set; }
 128    public string MetadataJson { get; set; } = "{}";
 129}
 130
 131public enum UserTaskPersistenceOperationStatus
 132{
 133    Pending,
 134    Enqueued,
 135    Completed,
 136    Failed,
 137    Abandoned
 138}
 139
 140public sealed class UserTaskOperationRecord
 141{
 142    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 143    public string TenantId { get; set; } = default!;
 144    public string TaskId { get; set; } = default!;
 145    public string OperationId { get; set; } = default!;
 146    public string Kind { get; set; } = default!;
 147    public int ExpectedRevision { get; set; }
 148    public string RequestHash { get; set; } = default!;
 149    public UserTaskPersistenceOperationStatus Status { get; set; }
 150    public int Attempts { get; set; }
 151    public string? SafeResultJson { get; set; }
 152    public string? ProtectedPayloadJson { get; set; }
 153    public string? ActionKey { get; set; }
 154    public string? ErrorCode { get; set; }
 155    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 156    public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
 157    public DateTimeOffset? CompletedAt { get; set; }
 158}
 159
 160public sealed class UserTaskInvitationRecord
 161{
 162    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 163    public string TenantId { get; set; } = default!;
 164    public string TaskId { get; set; } = default!;
 165    public string? SiblingGroupId { get; set; }
 166    public string? RecipientJson { get; set; }
 167    public string TokenHash { get; set; } = default!;
 168    public string VerifierProvider { get; set; } = default!;
 169    public string AllowedActionsJson { get; set; } = "[]";
 170    public string? ChallengeJson { get; set; }
 171    public UserTaskInvitationStatus Status { get; set; }
 172    public DateTimeOffset IssuedAt { get; set; } = DateTimeOffset.UtcNow;
 173    public DateTimeOffset ExpiresAt { get; set; }
 174    public DateTimeOffset? VerifiedAt { get; set; }
 175    public DateTimeOffset? ConsumedAt { get; set; }
 176    public DateTimeOffset? RevokedAt { get; set; }
 177}
 178
 179public enum UserTaskPersistenceDeliveryStatus
 180{
 181    Pending,
 182    Processing,
 183    Delivered,
 184    Failed,
 185    Expired
 186}
 187
 188public sealed class UserTaskInvitationDeliveryRecord
 189{
 190    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 191    public string TenantId { get; set; } = default!;
 192    public string TaskId { get; set; } = default!;
 193    public string InvitationId { get; set; } = default!;
 194    public string DispatcherProvider { get; set; } = default!;
 195    public string EncryptedToken { get; set; } = default!;
 196    public string? DeliveryMetadataJson { get; set; }
 197    public UserTaskPersistenceDeliveryStatus Status { get; set; }
 198    public int Attempts { get; set; }
 199    public DateTimeOffset AvailableAt { get; set; } = DateTimeOffset.UtcNow;
 200    public DateTimeOffset ExpiresAt { get; set; }
 201    public string? LastErrorCode { get; set; }
 202    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 203    public DateTimeOffset? DeliveredAt { get; set; }
 204}
 205
 206public sealed class UserTaskGuestSessionRecord
 207{
 22208    public string Id { get; set; } = Guid.NewGuid().ToString("N");
 22209    public string TenantId { get; set; } = default!;
 22210    public string TaskId { get; set; } = default!;
 22211    public string InvitationId { get; set; } = default!;
 15212    public string SessionTokenHash { get; set; } = default!;
 22213    public string GuestParticipantJson { get; set; } = default!;
 44214    public string CapabilitiesJson { get; set; } = "[]";
 37215    public DateTimeOffset IssuedAt { get; set; } = DateTimeOffset.UtcNow;
 22216    public DateTimeOffset ExpiresAt { get; set; }
 0217    public DateTimeOffset? RevokedAt { get; set; }
 218}