mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Completes the scheduled jobs module with default jobs, a themed scheduler page and aligned recovery semantics
This commit is contained in:
1 parent
99a6159f7f
commit
4b7cfbbe11
67 files changed
+3324
-745
No files matched your search
+21
@@ -69,6 +69,27 @@ public class ScheduledJobEntityFixture
|
||||
UpdatedBy = null
|
||||
};
|
||||
}
|
||||
if (resolvedScheduleType == ScheduleType.OnceAtStartup)
|
||||
{
|
||||
return new ScheduledJobEntity
|
||||
{
|
||||
Id = id ?? Guid.NewGuid(),
|
||||
Name = name ?? f.Commerce.ProductName(),
|
||||
TaskType = taskType ?? f.PickRandom<ScheduledTaskType>(),
|
||||
ScheduleType = resolvedScheduleType,
|
||||
IntervalMinutes = null,
|
||||
Hour = null,
|
||||
Minute = null,
|
||||
Status = status ?? f.PickRandom<ScheduledJobStatus>(),
|
||||
OwnerUserId = ownerUserId ?? Guid.NewGuid(),
|
||||
LastStartedOnUtc = lastStartedOnUtc,
|
||||
LastCompletedOnUtc = lastCompletedOnUtc,
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
}
|
||||
return new ScheduledJobEntity
|
||||
{
|
||||
Id = id ?? Guid.NewGuid(),
|
||||
|
||||
+3
@@ -23,6 +23,7 @@ public class ScheduledJobExecutionEntityFixture
|
||||
/// <param name="scheduledJobId">Optional. The Id of the scheduled job whose task was executed.</param>
|
||||
/// <param name="taskType">Optional. The type of the task that was executed.</param>
|
||||
/// <param name="isCycleRun">Optional. Whether the execution was a cycle run.</param>
|
||||
/// <param name="wasCycleActive">Optional. Whether the execution cycle of the scheduled job was active when the execution started.</param>
|
||||
/// <param name="startedOnUtc">Optional. The start time of the execution.</param>
|
||||
/// <param name="completedOnUtc">Optional. The completion time of the execution.</param>
|
||||
/// <returns>The created <see cref="ScheduledJobExecutionEntity"/>.</returns>
|
||||
@@ -31,6 +32,7 @@ public class ScheduledJobExecutionEntityFixture
|
||||
Guid? scheduledJobId = null,
|
||||
ScheduledTaskType? taskType = null,
|
||||
bool? isCycleRun = null,
|
||||
bool? wasCycleActive = null,
|
||||
DateTime? startedOnUtc = null,
|
||||
DateTime? completedOnUtc = null)
|
||||
{
|
||||
@@ -41,6 +43,7 @@ public class ScheduledJobExecutionEntityFixture
|
||||
ScheduledJobId = scheduledJobId ?? Guid.NewGuid(),
|
||||
TaskType = taskType ?? f.PickRandom<ScheduledTaskType>(),
|
||||
IsCycleRun = isCycleRun ?? f.Random.Bool(),
|
||||
WasCycleActive = wasCycleActive ?? f.Random.Bool(),
|
||||
StartedOnUtc = startedOnUtc ?? DateTime.UtcNow,
|
||||
CompletedOnUtc = completedOnUtc,
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.SchedulingBoundedContext.ScheduledJobAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.SchedulingBoundedContext.ScheduledJobAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="OnceAtStartupSchedule"/> value object.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class OnceAtStartupScheduleFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a valid <see cref="OnceAtStartupSchedule"/>.
|
||||
/// </summary>
|
||||
/// <returns>The created <see cref="OnceAtStartupSchedule"/>.</returns>
|
||||
public OnceAtStartupSchedule Create()
|
||||
{
|
||||
return OnceAtStartupSchedule.Create().Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="OnceAtStartupSchedule"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="OnceAtStartupSchedule"/> instances.</returns>
|
||||
public List<OnceAtStartupSchedule> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user