refactor(core): reorganize DTOs into Models and ViewModels folders
Move DTOs from ApiContracts to appropriate locations: - SignalR DTOs → ViewModels (renamed Dto→ViewModel suffix) - Pipeline DTOs → Models/Pipelines - UserInfoDto → Models/Auth - DataUpdateDto → Models/Infrastructure
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using JdeScoping.Core.ApiContracts.Auth;
|
||||
|
||||
namespace JdeScoping.Core.Models.Auth;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace JdeScoping.Core.Models.Auth;
|
||||
|
||||
/// <summary>
|
||||
/// API response DTO for authenticated user information.
|
||||
/// </summary>
|
||||
public record UserInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// User's login username.
|
||||
/// </summary>
|
||||
public string Username { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User's first name.
|
||||
/// </summary>
|
||||
public string FirstName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User's last name.
|
||||
/// </summary>
|
||||
public string LastName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User's display name (computed on server).
|
||||
/// </summary>
|
||||
public string DisplayName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User's organization title.
|
||||
/// </summary>
|
||||
public string Title { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User's email address.
|
||||
/// </summary>
|
||||
public string EmailAddress { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a UserInfoDto from a UserInfo entity.
|
||||
/// </summary>
|
||||
/// <param name="userInfo">The UserInfo entity to convert.</param>
|
||||
/// <returns>A new UserInfoDto instance.</returns>
|
||||
public static UserInfoDto FromUserInfo(UserInfo userInfo) => new()
|
||||
{
|
||||
Username = userInfo.Username,
|
||||
FirstName = userInfo.FirstName,
|
||||
LastName = userInfo.LastName,
|
||||
DisplayName = userInfo.DisplayName,
|
||||
Title = userInfo.Title,
|
||||
EmailAddress = userInfo.EmailAddress
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace JdeScoping.Core.Models.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// DTO for data refresh/sync status display.
|
||||
/// Aggregates record counts from multiple table updates into a single row.
|
||||
/// </summary>
|
||||
public class DataUpdateDto
|
||||
{
|
||||
public DateTime StartDt { get; set; }
|
||||
public DateTime? EndDt { get; set; }
|
||||
|
||||
public int BranchRecords { get; set; }
|
||||
public int ProfitCenterRecords { get; set; }
|
||||
public int WorkCenterRecords { get; set; }
|
||||
public int OrgHierarchyRecords { get; set; }
|
||||
public int StatusCodeRecords { get; set; }
|
||||
public int UserRecords { get; set; }
|
||||
public int ItemRecords { get; set; }
|
||||
public int LotRecords { get; set; }
|
||||
public int WorkOrderRecords { get; set; }
|
||||
public int WorkOrderStepRecords { get; set; }
|
||||
public int WorkOrderComponentRecords { get; set; }
|
||||
|
||||
public bool WasSuccessful { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace JdeScoping.Core.Models.Pipelines;
|
||||
|
||||
/// <summary>
|
||||
/// Pipeline configuration DTO for display.
|
||||
/// </summary>
|
||||
public record PipelineConfigDto(
|
||||
string Name,
|
||||
PipelineSourceDto Source,
|
||||
PipelineDestinationDto Destination,
|
||||
PipelineSchedulesDto Schedules,
|
||||
int PreScriptCount,
|
||||
int PostScriptCount,
|
||||
List<string>? PreScripts,
|
||||
List<string>? PostScripts);
|
||||
|
||||
public record PipelineSourceDto(
|
||||
string Connection,
|
||||
string? QueryPreview,
|
||||
string? MassQueryPreview,
|
||||
string? Query,
|
||||
string? MassQuery,
|
||||
List<PipelineParameterDto> Parameters);
|
||||
|
||||
public record PipelineParameterDto(
|
||||
string Name,
|
||||
string? Format,
|
||||
string Source);
|
||||
|
||||
public record PipelineDestinationDto(
|
||||
string Table,
|
||||
string OperationType,
|
||||
List<string>? MatchColumns,
|
||||
List<string>? ExcludeFromUpdate);
|
||||
|
||||
public record PipelineSchedulesDto(
|
||||
PipelineScheduleDto Mass,
|
||||
PipelineScheduleDto Daily,
|
||||
PipelineScheduleDto Hourly);
|
||||
|
||||
public record PipelineScheduleDto(
|
||||
bool Enabled,
|
||||
int IntervalMinutes,
|
||||
bool PrePurge,
|
||||
bool ReIndex,
|
||||
bool IntervalIsOverride,
|
||||
bool PrePurgeIsOverride,
|
||||
bool ReIndexIsOverride,
|
||||
string? Query,
|
||||
List<PipelineParameterDto> Parameters,
|
||||
List<string>? PreScripts,
|
||||
List<string>? PostScripts);
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace JdeScoping.Core.Models.Pipelines;
|
||||
|
||||
using JdeScoping.Core.Models.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Pipeline execution history.
|
||||
/// </summary>
|
||||
public record PipelineExecutionsResponse(List<PipelineExecutionDto> Executions);
|
||||
|
||||
public record PipelineExecutionDto(
|
||||
UpdateTypes ScheduleType,
|
||||
DateTime StartTime,
|
||||
DateTime? EndTime,
|
||||
TimeSpan? Duration,
|
||||
long RecordCount,
|
||||
bool WasSuccessful);
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace JdeScoping.Core.Models.Pipelines;
|
||||
|
||||
/// <summary>
|
||||
/// Response containing list of available pipeline names.
|
||||
/// </summary>
|
||||
public record PipelineListResponse(List<string> PipelineNames);
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace JdeScoping.Core.Models.Pipelines;
|
||||
|
||||
using JdeScoping.Core.Models.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Pipeline schedule status for each update type.
|
||||
/// </summary>
|
||||
public record PipelineStatusResponse(List<PipelineScheduleStatusDto> Statuses);
|
||||
|
||||
public record PipelineScheduleStatusDto(
|
||||
UpdateTypes ScheduleType,
|
||||
DateTime? LastRun,
|
||||
bool LastRunWasSuccessful,
|
||||
DateTime? LastSuccessfulRun,
|
||||
DateTime? NextRequiredRun,
|
||||
bool IsOverdue,
|
||||
int IntervalMinutes);
|
||||
Reference in New Issue
Block a user