add count in cron tab

This commit is contained in:
Jicheng Lu 2024-12-16 10:17:50 -06:00
parent 28b6bcb2ce
commit 387bbe98c6
2 changed files with 18 additions and 0 deletions

View file

@ -14,6 +14,15 @@ public class CrontabItem : ScheduleTaskArgs
[JsonPropertyName("execution_result")]
public string ExecutionResult { get; set; } = null!;
[JsonPropertyName("execution_count")]
public int ExecutionCount { get; set; }
[JsonPropertyName("max_execution_count")]
public int MaxExecutionCount { get; set; }
[JsonPropertyName("expire_seconds")]
public int ExpireSeconds { get; set; } = 60;
[JsonPropertyName("created_time")]
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;

View file

@ -11,6 +11,9 @@ public class CrontabItemDocument : MongoBase
public string Cron { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public int ExecutionCount { get; set; }
public int MaxExecutionCount { get; set; }
public int ExpireSeconds { get; set; } = 60;
public IEnumerable<CronTaskMongoElement> Tasks { get; set; } = [];
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
@ -25,6 +28,9 @@ public class CrontabItemDocument : MongoBase
Cron = item.Cron,
Title = item.Title,
Description = item.Description,
ExecutionCount = item.ExecutionCount,
MaxExecutionCount = item.MaxExecutionCount,
ExpireSeconds = item.ExpireSeconds,
Tasks = item.Tasks?.Select(x => CronTaskMongoElement.ToDomainElement(x))?.ToArray() ?? [],
CreatedTime = item.CreatedTime
};
@ -41,6 +47,9 @@ public class CrontabItemDocument : MongoBase
Cron = item.Cron,
Title = item.Title,
Description = item.Description,
ExecutionCount = item.ExecutionCount,
MaxExecutionCount = item.MaxExecutionCount,
ExpireSeconds = item.ExpireSeconds,
Tasks = item.Tasks?.Select(x => CronTaskMongoElement.ToMongoElement(x))?.ToList() ?? [],
CreatedTime = item.CreatedTime
};