Refactor code structure for improved readability and maintainability

This commit is contained in:
Torsten Brendgen
2026-05-16 16:45:28 +02:00
parent 14f856fdb3
commit 96a3e98109
426 changed files with 29236 additions and 114 deletions

View File

@@ -0,0 +1,9 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add
{
public class AddDeploymentRequestDto
{
public Guid DeploymentGroupId { get; set; }
public ICollection<Guid> VirtualMachineIds { get; set; } = new List<Guid>();
public string JsonData { get; set; } = "{}";
}
}

View File

@@ -0,0 +1,8 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add
{
public class QueueJobStepApprovalDto
{
public string? Comment { get; set; }
public string? ApprovedBy { get; set; }
}
}

View File

@@ -1,16 +1,13 @@
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetDeploymentDetailsDto : BaseDetailsDto
{
public Guid VirtualMachineId { get; set; }
public string Status { get; set; }
public string JSONData { get; set; }
public GetVirtualMachineDetailsDto VirtualMachine { get; set; }
public GetDeploymentGroupDetailsDto DeploymentGroup { get; set; }
}
}

View File

@@ -4,7 +4,9 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetDeploymentDto : BaseDto
{
public Guid DeploymentGroupId { get; set; }
public Guid VirtualMachineId { get; set; }
public string Status { get; set; }
public string JSONData { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetQueueJobDetailsDto : BaseDetailsDto
{
public string Type { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string PayloadJson { get; set; } = string.Empty;
public int Attempts { get; set; }
public int MaxAttempts { get; set; }
public DateTime? Started { get; set; }
public DateTime? Finished { get; set; }
public string? ErrorMessage { get; set; }
public string? MetadataJson { get; set; }
public string? RuleSnapshotJson { get; set; }
public ICollection<GetQueueJobTargetDto> Targets { get; set; } = new List<GetQueueJobTargetDto>();
public ICollection<GetQueueJobStepDto> Steps { get; set; } = new List<GetQueueJobStepDto>();
}
}

View File

@@ -0,0 +1,16 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetQueueJobDto : BaseDto
{
public string Type { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public int Attempts { get; set; }
public int MaxAttempts { get; set; }
public DateTime? Started { get; set; }
public DateTime? Finished { get; set; }
public string? ErrorMessage { get; set; }
public int TargetCount { get; set; }
public int SucceededTargetCount { get; set; }
public int FailedTargetCount { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetQueueJobStepDto : BaseDto
{
public Guid? DependsOnQueueJobStepId { get; set; }
public int SortOrder { get; set; }
public string Name { get; set; } = string.Empty;
public string StepType { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string? MetadataJson { get; set; }
public DateTime? ApprovedAt { get; set; }
public string? ApprovedBy { get; set; }
public string? ApprovalComment { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetQueueJobTargetDto : BaseDto
{
public Guid VirtualMachineId { get; set; }
public Guid DeploymentGroupId { get; set; }
public Guid TemplateId { get; set; }
public string Status { get; set; } = string.Empty;
public int Attempts { get; set; }
public string? ErrorMessage { get; set; }
}
}

View File

@@ -8,7 +8,8 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Add
public Guid TemplateId { get; set; }
[Column(Order = 2)]
public string Status { get; set; }
[Column(Order = 3)]
public ICollection<Guid>? VirtualMachineIds { get; set; }
}
}

View File

@@ -6,5 +6,20 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Add
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string EnvironmentType { get; set; } = "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; }
}
}

View File

@@ -6,5 +6,20 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Edit
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string EnvironmentType { get; set; } = "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; }
}
}

View File

@@ -6,5 +6,20 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string EnvironmentType { get; set; }
[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; }
}
}

View File

@@ -1,11 +1,34 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
public class GetEnvironmentDomainDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public ICollection<GetEnvironmentDetailsDto> Environment { get; set; }
public GetDomainDetailsDto Domain { get; set; }
public static GetEnvironmentDomainDetailsDto FromModel(EnvironmentDomainsModel environmentDomain)
{
return new GetEnvironmentDomainDetailsDto
{
Created = environmentDomain.Created,
CreatedBy = environmentDomain.CreatedBy,
Modified = environmentDomain.Modified,
ModifiedBy = environmentDomain.ModifiedBy,
Domain = new GetDomainDetailsDto
{
Id = environmentDomain.Domain.Id,
Name = environmentDomain.Domain.Name,
FQDN = environmentDomain.Domain.FQDN,
NetBIOS = environmentDomain.Domain.NetBIOS,
Created = environmentDomain.Domain.Created,
CreatedBy = environmentDomain.Domain.CreatedBy,
Modified = environmentDomain.Domain.Modified,
ModifiedBy = environmentDomain.Domain.ModifiedBy
}
};
}
}
}

View File

@@ -1,4 +1,4 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
@@ -7,8 +7,25 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public ICollection<GetEnvironmentDomainDetailsDto> EnvironmentDomains { get; set; }
}
public static GetEnvironmentDomainDto FromModel(EnvironmentModel environment)
{
return new GetEnvironmentDomainDto
{
Id = environment.Id,
Name = environment.Name,
Created = environment.Created,
CreatedBy = environment.CreatedBy,
Modified = environment.Modified,
ModifiedBy = environment.ModifiedBy,
EnvironmentDomains = environment.EnvironmentDomains?
.Where(environmentDomain => environmentDomain.Domain != null)
.Select(GetEnvironmentDomainDetailsDto.FromModel)
.ToList() ?? new List<GetEnvironmentDomainDetailsDto>()
};
}
}
}

View File

@@ -6,5 +6,17 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string EnvironmentType { get; set; }
[Column(Order = 3)]
public string? ProviderType { get; set; }
[Column(Order = 4)]
public string? TenantId { get; set; }
[Column(Order = 5)]
public string? SubscriptionId { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Add
{
public class AddServiceDto
{
[Column(Order = 1)]
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; }
}
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Edit
{
public class EditServiceDto
{
[Column(Order = 1)]
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; }
}
}

View File

@@ -7,6 +7,10 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Get
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Type { get; set; }
public string Description { get; set; }
[Column(Order = 3)]
public bool IsCloudService { get; set; }
[Column(Order = 4)]
public string? IconKey { get; set; }
}
}

View File

@@ -6,5 +6,14 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Get
{
[Column(Order = 1)]
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; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.RoleDefinition
{
public class AddServiceRoleDefinitionDto
{
public string Key { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.RoleDefinition
{
public class EditServiceRoleDefinitionDto
{
public string Key { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Template.Add
{
public class AddTemplateDto
{
[Column(Order = 1)]
public Guid TemplateCategoryId { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
[Column(Order = 3)]
public string Version { get; set; }
[Column(Order = 4)]
public string Description { get; set; }
[Column(Order = 5)]
public string JSONData { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Template.Edit
{
public class EditTemplateDto
{
[Column(Order = 1)]
public Guid TemplateCategoryId { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
[Column(Order = 3)]
public string Version { get; set; }
[Column(Order = 4)]
public string Description { get; set; }
[Column(Order = 5)]
public string JSONData { get; set; }
}
}

View File

@@ -3,7 +3,7 @@
public class GetTemplateDetailsDto : BaseDetailsDto
{
public string Name { get; set; }
public string CloudTemplate { get; set; }
public Guid TemplateCategoryId { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public string JSONData { get; set; }

View File

@@ -3,6 +3,9 @@
public class GetTemplateDto : BaseDto
{
public string Name { get; set; }
public Guid TemplateCategoryId { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public string JSONData { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.TemplateCategory.Add
{
public class AddTemplateCategoryDto
{
public Guid ServiceId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.TemplateCategory.Edit
{
public class EditTemplateCategoryDto
{
public Guid ServiceId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.TemplateCategory.Get
{
public class GetTemplateCategoryDetailsDto : BaseDetailsDto
{
public Guid ServiceId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; }
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.TemplateCategory.Get
{
public class GetTemplateCategoryDto : BaseDto
{
public Guid ServiceId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; }
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Add
{
public class AddVirtualMachineDto
{
public Guid? DomainID { get; set; }
public string Name { get; set; }
public string? ExternalId { get; set; }
public string? MetadataJson { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Edit
{
public class EditVirtualMachineDto
{
public string Name { get; set; }
public string? ExternalId { get; set; }
public string? MetadataJson { get; set; }
}
}

View File

@@ -8,8 +8,17 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get
{
[Column(Order = 1)]
public Guid? DomainID { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
public GetDomainDto Domain { get; set; }
[Column(Order = 3)]
public string? ExternalId { get; set; }
[Column(Order = 4)]
public string? MetadataJson { get; set; }
public GetDomainDto? Domain { get; set; }
}
}

View File

@@ -5,7 +5,13 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get
public class GetVirtualMachineDto : BaseDto
{
[Column(Order = 1)]
public Guid? DomainID { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
[Column(Order = 3)]
public string? ExternalId { get; set; }
}
}