Merge pull request #799 from iceljc/master

add count in cron tab
This commit is contained in:
iceljc 2024-12-16 10:19:02 -06:00 committed by GitHub
commit b1109001ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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; }
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
};