Refactor code structure for improved readability and maintainability
This commit is contained in:
46
Models/DeploymentJobModel.cs
Normal file
46
Models/DeploymentJobModel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class QueueJobModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string Status { get; set; } = QueueJobStatus.Pending;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string PayloadJson { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int Attempts { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public int MaxAttempts { get; set; } = 3;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public DateTime? Started { get; set; }
|
||||
|
||||
[Column(Order = 7)]
|
||||
public DateTime? Finished { get; set; }
|
||||
|
||||
[Column(Order = 8)]
|
||||
public DateTime? LockedUntil { get; set; }
|
||||
|
||||
[Column(Order = 9)]
|
||||
public string? LockedBy { get; set; }
|
||||
|
||||
[Column(Order = 10)]
|
||||
public string? ErrorMessage { get; set; }
|
||||
|
||||
[Column(Order = 11)]
|
||||
public string? MetadataJson { get; set; }
|
||||
|
||||
[Column(Order = 12)]
|
||||
public string? RuleSnapshotJson { get; set; }
|
||||
|
||||
public ICollection<QueueJobTargetModel> Targets { get; set; } = new List<QueueJobTargetModel>();
|
||||
public ICollection<QueueJobStepModel> Steps { get; set; } = new List<QueueJobStepModel>();
|
||||
}
|
||||
}
|
||||
40
Models/DeploymentJobStepModel.cs
Normal file
40
Models/DeploymentJobStepModel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class QueueJobStepModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public Guid QueueJobId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public Guid? DependsOnQueueJobStepId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public string StepType { get; set; } = QueueJobStepType.Provision;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public string Status { get; set; } = QueueJobStatus.Pending;
|
||||
|
||||
[Column(Order = 7)]
|
||||
public string? MetadataJson { get; set; }
|
||||
|
||||
[Column(Order = 8)]
|
||||
public DateTime? ApprovedAt { get; set; }
|
||||
|
||||
[Column(Order = 9)]
|
||||
public string? ApprovedBy { get; set; }
|
||||
|
||||
[Column(Order = 10)]
|
||||
public string? ApprovalComment { get; set; }
|
||||
|
||||
public QueueJobModel QueueJob { get; set; }
|
||||
public QueueJobStepModel? DependsOnQueueJobStep { get; set; }
|
||||
}
|
||||
}
|
||||
30
Models/DeploymentJobTargetModel.cs
Normal file
30
Models/DeploymentJobTargetModel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class QueueJobTargetModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public Guid QueueJobId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public Guid VirtualMachineId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public Guid DeploymentGroupId { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public Guid TemplateId { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public string Status { get; set; } = QueueJobStatus.Pending;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public int Attempts { get; set; }
|
||||
|
||||
[Column(Order = 7)]
|
||||
public string? ErrorMessage { get; set; }
|
||||
|
||||
public QueueJobModel QueueJob { get; set; }
|
||||
}
|
||||
}
|
||||
18
Models/DeploymentRuleModel.cs
Normal file
18
Models/DeploymentRuleModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class DeploymentRuleModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
public ICollection<DeploymentRuleStepModel> Steps { get; set; } = new List<DeploymentRuleStepModel>();
|
||||
}
|
||||
}
|
||||
27
Models/DeploymentRuleStepModel.cs
Normal file
27
Models/DeploymentRuleStepModel.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class DeploymentRuleStepModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public Guid DeploymentRuleId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string StepType { get; set; } = QueueJobStepType.Provision;
|
||||
|
||||
[Column(Order = 5)]
|
||||
public bool RequiresApproval { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public string? MetadataJson { get; set; }
|
||||
|
||||
public DeploymentRuleModel DeploymentRule { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,19 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public bool CloudEnabled { get; set; }
|
||||
public string EnvironmentType { get; set; } = EnvironmentTypes.OnPrem;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string? ProviderType { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string? TenantId { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public string? SubscriptionId { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public string? MetadataJson { get; set; }
|
||||
|
||||
public ICollection<EnvironmentDomainsModel> EnvironmentDomains { get; set; }
|
||||
}
|
||||
|
||||
9
Models/EnvironmentTypes.cs
Normal file
9
Models/EnvironmentTypes.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public static class EnvironmentTypes
|
||||
{
|
||||
public const string OnPrem = "OnPrem";
|
||||
public const string AzureTenant = "AzureTenant";
|
||||
public const string M365Tenant = "M365Tenant";
|
||||
}
|
||||
}
|
||||
13
Models/QueueJobStatus.cs
Normal file
13
Models/QueueJobStatus.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public static class QueueJobStatus
|
||||
{
|
||||
public const string Pending = "Pending";
|
||||
public const string Running = "Running";
|
||||
public const string WaitingForApproval = "WaitingForApproval";
|
||||
public const string Succeeded = "Succeeded";
|
||||
public const string Failed = "Failed";
|
||||
public const string Rejected = "Rejected";
|
||||
public const string Cancelled = "Cancelled";
|
||||
}
|
||||
}
|
||||
8
Models/QueueJobStepType.cs
Normal file
8
Models/QueueJobStepType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public static class QueueJobStepType
|
||||
{
|
||||
public const string Provision = "Provision";
|
||||
public const string Approval = "Approval";
|
||||
}
|
||||
}
|
||||
8
Models/QueueJobType.cs
Normal file
8
Models/QueueJobType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public static class QueueJobType
|
||||
{
|
||||
public const string TemplateJsonChanged = "TemplateJsonChanged";
|
||||
public const string DeploymentRequested = "DeploymentRequested";
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,13 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
public string Name { get; set; }
|
||||
[Column(Order = 2)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool IsCloudService { get; set; }
|
||||
[Column(Order = 4)]
|
||||
public string? IconKey { get; set; }
|
||||
|
||||
public ICollection<TemplateCategoryModel> TemplateCategories { get; set; }
|
||||
public ICollection<TemplateCategoryModel> TemplateCategories { get; set; } = new List<TemplateCategoryModel>();
|
||||
public ICollection<ServiceRoleDefinitionModel> RoleDefinitions { get; set; } = new List<ServiceRoleDefinitionModel>();
|
||||
}
|
||||
}
|
||||
|
||||
21
Models/ServiceRoleDefinitionModel.cs
Normal file
21
Models/ServiceRoleDefinitionModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
{
|
||||
public class ServiceRoleDefinitionModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public Guid ServiceId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public ServiceModel Service { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,16 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
[Column(Order = 1)]
|
||||
public Guid ServiceId { get; set; }
|
||||
[Column(Order = 2)]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Column(Order = 3)]
|
||||
public string ParentCategoryName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
[Column(Order = 4)]
|
||||
public int showOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
[Column(Order = 5)]
|
||||
public string? Color { get; set; }
|
||||
|
||||
public ServiceModel Service { get; set; }
|
||||
public ServiceModel Service { get; set; } = null!;
|
||||
|
||||
public ICollection<TemplateModel> Templates { get; set; }
|
||||
public ICollection<TemplateModel> Templates { get; set; } = new List<TemplateModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,20 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
[Column(Order = 1)]
|
||||
public string Name { get; set; }
|
||||
[Column(Order = 2)]
|
||||
[RegularExpression("On Premise|Hybrid|Cloud")]
|
||||
public bool CloudTemplate { get; set; }
|
||||
[Column(Order = 3)]
|
||||
public string Version { get; set; }
|
||||
[Column(Order = 4)]
|
||||
[Column(Order = 3)]
|
||||
public string Description { get; set; }
|
||||
[Column(Order = 5)]
|
||||
[Column(Order = 4)]
|
||||
public string JSONData { get; set; }
|
||||
|
||||
|
||||
[Column(Order = 5)]
|
||||
public Guid TemplateCategoryId { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public Guid? DeploymentRuleId { get; set; }
|
||||
|
||||
public TemplateCategoryModel TemplateCategory { get; set; }
|
||||
public DeploymentRuleModel? DeploymentRule { get; set; }
|
||||
|
||||
public ICollection<DeploymentGroupModel> DeploymentGroups { get; set; }
|
||||
public ICollection<TemplateOptionModel> TemplateOptions { get; set; }
|
||||
|
||||
@@ -6,12 +6,18 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
|
||||
public class VirtualMachineModel : BaseModel
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public Guid DomainID { get; set; }
|
||||
public Guid? DomainID { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string? ExternalId { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string? MetadataJson { get; set; }
|
||||
|
||||
public DomainModel Domain { get; set; }
|
||||
public DomainModel? Domain { get; set; }
|
||||
|
||||
public ICollection<DeploymentModel> Deployments { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user