This commit is contained in:
Zeeshaun
2026-03-24 15:26:03 -05:00
parent 1e5beb292a
commit 9cc87337b8
333 changed files with 17931 additions and 0 deletions
@@ -0,0 +1,7 @@
namespace LCU.Library.Internal.DispatcherModels.Models;
public class DispatcherReturnResponse
{
public int WorkItemId { get; set; }
public bool Skipped { get; set; } = false;
}
@@ -0,0 +1,6 @@
namespace LCU.Library.Internal.DispatcherModels.Models;
public class Errorable
{
public int? AttemptsToExecute { get; set; }
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LCU.Library.Internal.DispatcherModels.Models;
public class Filter
{
/// <summary>
/// Filter has default of all statuses minus Inactive and default to NextRunTime Ascending for sorting.
/// This prevents null NextRunTimes to display first, user will see the most recent NextRunTime
/// </summary>
public Filter()
{
var listStatus = new List<StatusFilter>();
foreach (var item in Enum.GetValues(typeof(Enums.JobStatus)))
{
if ((Enums.JobStatus)item != Enums.JobStatus.Inactive)
{
StatusFilter statusFilter = new() { IsEnabled = true, JobStatus = (Enums.JobStatus)item };
listStatus.Add(statusFilter);
}
}
var listSortableFields = new List<SortableField>();
SortableField sortField = new() { Field = Constants.JobSortableFields.NextRunTime, IsDescending = false };
listSortableFields.Add(sortField);
StatusFilters = listStatus;
SortableFields = listSortableFields;
Page = 1;
Limit = 10;
}
public string JobName { get; set; }
public string JobDescription { get; set; }
public DateTime? NextRuntimeGreaterThanDate { get; set; } = null;
public List<StatusFilter> StatusFilters { get; set; }
public List<int> TagIdFilters { get; set; }
public List<SortableField> SortableFields { get; set; }
[Range(1, 1000)]
public int Page { get; set; }
[Range(1, 1000)]
public int Limit { get; set; }
}
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Enums;
namespace LCU.Library.Internal.DispatcherModels.Models;
public class JobDetails
{
public int JobId { get; set; } = 0;
[StringLength(200, ErrorMessage = "Requesting Application Max Length is 200")]
public string RequestingApplication { get; set; }
[Required]
[StringLength(200, ErrorMessage = "Name Max Length is 200")]
public string Name { get; set; }
[StringLength(8000, ErrorMessage = "Description Max Length is 8000")]
public string Description { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public string ModifiedBy { get; set; }
public DateTime? ModifiedDate { get; set; }
public string CronSchedule { get; set; }
public DateTime? NextRunTime { get; set; }
public bool SkipHolidays { get; set; } = false;
public JobStatus JobStatus { get; set; } = JobStatus.Inactive;
public List<string> ErrorRecipients { get; set; }
public List<JobTag> JobTags { get; set; }
}
@@ -0,0 +1,9 @@
namespace LCU.Library.Internal.DispatcherModels.Models;
public class JobErrorDetail
{
public string JobName { get; set; }
public string WorkItemName { get; set; }
public string JobStatus { get; set; }
public string StartTime { get; set; }
}
@@ -0,0 +1,31 @@
using LCU.Library.Internal.DispatcherModels.Models.Results;
using System;
using System.Collections.Generic;
namespace LCU.Library.Internal.DispatcherModels.Models;
public class PagedResponse<T> where T : class
{
public PagedResponse() { }
public PagedResponse(PagedResult<T> pagedResult, Filter filter)
{
TotalItems = pagedResult.Total;
Items = pagedResult.Items;
TotalPages = pagedResult.Total == 0 ? 1 : (int)Math.Ceiling((decimal)pagedResult.Total / filter.Limit);
CurrentPage = filter.Page > this.TotalPages ? this.TotalPages : filter.Page;
if (pagedResult.Total > (filter.Page * filter.Limit))
{
NextPage = filter.Page + 1;
}
if (filter.Page > 1)
{
PreviousPage = filter.Page - 1;
}
}
public IEnumerable<T> Items { get; set; }
public int NextPage { get; set; }
public int PreviousPage { get; set; }
public int TotalItems { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace LCU.Library.Internal.DispatcherModels.Models.Requests
{
public class BatchedErroredJobAlertRequest
{
public List<ErroredJobAlertRequest> ErroredJobAlertRequests { get; set; }
}
}
@@ -0,0 +1,7 @@
namespace LCU.Library.Internal.DispatcherModels.Models.Requests;
public class CopyJobRequest
{
public int JobId { get; set; }
public bool ChangeEnvironment { get; set; } = true;
}
@@ -0,0 +1,12 @@
using LCU.Library.Internal.DispatcherModels.Entities;
using LCU.Library.Internal.DispatcherModels.Enums;
namespace LCU.Library.Internal.DispatcherModels.Models.Requests
{
public class DetermineOperationRequest
{
public Job CurrentJob { get; set; }
public WorkItem CurrentWorkItem { get; set; }
public DetermineOperationType DetermineOperationType { get; set; }
}
}
@@ -0,0 +1,10 @@
using LCU.Library.Internal.DispatcherModels.Entities;
namespace LCU.Library.Internal.DispatcherModels.Models.Requests
{
public class ErroredJobAlertRequest
{
public Job CurrentJob { get; set; }
public WorkItem CurrentWorkItem { get; set; }
}
}
@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace LCU.Library.Internal.DispatcherModels.Models.Requests
{
public class JobFailureRequest
{
public int JobId { get; set; }
public int WorkItemId { get; set; }
public List<string> ExecutionMessages { get; set; }
}
}
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace LCU.Library.Internal.DispatcherModels.Models.Results
{
public class CleanUpJobBatchResult
{
public List<string> Messages { get; set; } = new List<string>();
public int FailureCount { get; set; } = 0;
[NotMapped]
public bool IsSuccessfull
{
get
{
return FailureCount == 0;
}
}
[NotMapped]
public bool IsFailure
{
get
{
return FailureCount > 0;
}
}
public void AddToFailureCount(string message)
{
Messages.Add(message);
FailureCount++;
}
}
}
@@ -0,0 +1,8 @@
using System.Collections.Generic;
namespace LCU.Library.Internal.DispatcherModels.Models.Results;
public class PagedResult<T> where T : class
{
public IEnumerable<T> Items { get; set; }
public int Total { get; set; }
}
@@ -0,0 +1,8 @@
namespace LCU.Library.Internal.DispatcherModels.Models;
public class SortableField
{
public string Field { get; set; }
public int Position { get; set; }
public bool IsDescending { get; set; }
}
@@ -0,0 +1,8 @@
using LCU.Library.Internal.DispatcherModels.Enums;
namespace LCU.Library.Internal.DispatcherModels.Models;
public class StatusFilter
{
public bool IsEnabled { get; set; }
public JobStatus JobStatus { get; set; }
}
@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace LCU.Library.Internal.DispatcherModels.Models
{
public class WorkItemDetails
{
public int WorkItemId { get; set; } = 0;
public int JobId { get; set; } = 0;
[Required]
[StringLength(200, ErrorMessage = "Name Max Length is 200")]
public string Name { get; set; }
[StringLength(8000, ErrorMessage = "Description Max Length is 8000")]
public string Description { get; set; }
public bool CancelJobOnFailure { get; set; } = false;
[Range(0, 100, ErrorMessage = "Limit Range must be between 0-100.")]
public int CancelJobLimit { get; set; } = 0;
[Required]
public int Order { get; set; }
}
}