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,6 +1,6 @@
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Claims;
|
||||
using JdeScoping.Core.ApiContracts.Auth;
|
||||
using JdeScoping.Core.Models.Auth;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
|
||||
namespace JdeScoping.Client.Auth;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using JdeScoping.Core.ApiContracts.Auth;
|
||||
using JdeScoping.Core.Models.Auth;
|
||||
|
||||
namespace JdeScoping.Client.Auth;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using JdeScoping.Core.ApiContracts.Auth;
|
||||
using JdeScoping.Core.Models.Auth;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace JdeScoping.Client.Auth;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@namespace JdeScoping.Client.Components.Admin
|
||||
@using JdeScoping.Core.ApiContracts.Pipelines
|
||||
@using JdeScoping.Core.Models.Pipelines
|
||||
@using JdeScoping.Core.Models.Enums
|
||||
|
||||
<RadzenCard class="rz-mb-4">
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace JdeScoping.Client.Models;
|
||||
|
||||
/// <summary>
|
||||
/// View model for data refresh/sync status display.
|
||||
/// </summary>
|
||||
public class DataUpdateViewModel
|
||||
{
|
||||
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; }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
@page "/admin/pipeline-viewer"
|
||||
@attribute [Authorize]
|
||||
@using JdeScoping.Core.ApiContracts
|
||||
@using JdeScoping.Core.ApiContracts.Pipelines
|
||||
@using JdeScoping.Core.Models.Pipelines
|
||||
@using JdeScoping.Core.Models.Enums
|
||||
@inject IPipelineApiClient PipelineApi
|
||||
|
||||
|
||||
@@ -31,31 +31,31 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<RadzenDataGrid Data="@_results" TItem="DataUpdateViewModel" AllowSorting="true" AllowPaging="true" PageSize="20"
|
||||
<RadzenDataGrid Data="@_results" TItem="DataUpdateDto" AllowSorting="true" AllowPaging="true" PageSize="20"
|
||||
PagerHorizontalAlign="HorizontalAlign.Center" AllowColumnResize="true" Style="text-align: center;">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="StartDT" Title="Start" Width="160px">
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="StartDT" Title="Start" Width="160px">
|
||||
<Template Context="item">
|
||||
@item.StartDt.ToString("MM/dd/yyyy hh:mm tt")
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="EndDT" Title="End" Width="160px">
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="EndDT" Title="End" Width="160px">
|
||||
<Template Context="item">
|
||||
@(item.EndDt?.ToString("MM/dd/yyyy hh:mm tt") ?? "")
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="BranchRecords" Title="Branch" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="ProfitCenterRecords" Title="Profit Center" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="WorkCenterRecords" Title="Work Center" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="OrgHierarchyRecords" Title="Org Hierarchy" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="StatusCodeRecords" Title="Status Code" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="UserRecords" Title="User" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="ItemRecords" Title="Item" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="LotRecords" Title="Lot" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="WorkOrderRecords" Title="Work Order" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="WorkOrderStepRecords" Title="WO Step" Width="90px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="WorkOrderComponentRecords" Title="WO Component" Width="110px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateViewModel" Property="WasSuccessful" Title="Was Successful?" Width="120px" TextAlign="TextAlign.Center">
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="BranchRecords" Title="Branch" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="ProfitCenterRecords" Title="Profit Center" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="WorkCenterRecords" Title="Work Center" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="OrgHierarchyRecords" Title="Org Hierarchy" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="StatusCodeRecords" Title="Status Code" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="UserRecords" Title="User" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="ItemRecords" Title="Item" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="LotRecords" Title="Lot" Width="80px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="WorkOrderRecords" Title="Work Order" Width="100px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="WorkOrderStepRecords" Title="WO Step" Width="90px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="WorkOrderComponentRecords" Title="WO Component" Width="110px" TextAlign="TextAlign.Center" />
|
||||
<RadzenDataGridColumn TItem="DataUpdateDto" Property="WasSuccessful" Title="Was Successful?" Width="120px" TextAlign="TextAlign.Center">
|
||||
<Template Context="item">
|
||||
@if (item.WasSuccessful)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ else
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<DataUpdateViewModel> _results = [];
|
||||
private List<DataUpdateDto> _results = [];
|
||||
private bool _isLoading = true;
|
||||
|
||||
// Default to last 7 days
|
||||
|
||||
@@ -315,7 +315,7 @@ else
|
||||
await HubConnection.StartAsync();
|
||||
}
|
||||
|
||||
private void HandleSearchUpdate(SearchUpdateDto update)
|
||||
private void HandleSearchUpdate(SearchUpdateViewModel update)
|
||||
{
|
||||
if (update.Id == _search.Id)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSearchUpdate(SearchUpdateDto update)
|
||||
private void HandleSearchUpdate(SearchUpdateViewModel update)
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
@@ -162,7 +162,7 @@ else
|
||||
});
|
||||
}
|
||||
|
||||
private void HandleStatusUpdate(StatusUpdateDto update)
|
||||
private void HandleStatusUpdate(StatusUpdateViewModel update)
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ else
|
||||
await HubConnection.StartAsync();
|
||||
}
|
||||
|
||||
private void HandleSearchUpdate(SearchUpdateDto update)
|
||||
private void HandleSearchUpdate(SearchUpdateViewModel update)
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JdeScoping.Core.ApiContracts;
|
||||
using JdeScoping.Core.ApiContracts.Auth;
|
||||
using JdeScoping.Core.ApiContracts.Results;
|
||||
using JdeScoping.Core.Models.Auth;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using JdeScoping.Core.ApiContracts.SignalR;
|
||||
using JdeScoping.Core.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
|
||||
@@ -13,8 +13,8 @@ public class HubConnectionService : IHubConnectionService, IAsyncDisposable
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private HubConnection? _hubConnection;
|
||||
|
||||
public event Action<SearchUpdateDto>? OnSearchUpdate;
|
||||
public event Action<StatusUpdateDto>? OnStatusUpdate;
|
||||
public event Action<SearchUpdateViewModel>? OnSearchUpdate;
|
||||
public event Action<StatusUpdateViewModel>? OnStatusUpdate;
|
||||
|
||||
public bool IsConnected => _hubConnection?.State == HubConnectionState.Connected;
|
||||
|
||||
@@ -43,12 +43,12 @@ public class HubConnectionService : IHubConnectionService, IAsyncDisposable
|
||||
])
|
||||
.Build();
|
||||
|
||||
_hubConnection.On<SearchUpdateDto>("searchUpdate", update =>
|
||||
_hubConnection.On<SearchUpdateViewModel>("searchUpdate", update =>
|
||||
{
|
||||
OnSearchUpdate?.Invoke(update);
|
||||
});
|
||||
|
||||
_hubConnection.On<StatusUpdateDto>("statusUpdate", update =>
|
||||
_hubConnection.On<StatusUpdateViewModel>("statusUpdate", update =>
|
||||
{
|
||||
OnStatusUpdate?.Invoke(update);
|
||||
});
|
||||
@@ -92,7 +92,7 @@ public class HubConnectionService : IHubConnectionService, IAsyncDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<StatusUpdateDto?> GetCachedStatusAsync()
|
||||
public async Task<StatusUpdateViewModel?> GetCachedStatusAsync()
|
||||
{
|
||||
if (_hubConnection == null || _hubConnection.State != HubConnectionState.Connected)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public class HubConnectionService : IHubConnectionService, IAsyncDisposable
|
||||
|
||||
try
|
||||
{
|
||||
return await _hubConnection.InvokeAsync<StatusUpdateDto>("GetCachedStatus");
|
||||
return await _hubConnection.InvokeAsync<StatusUpdateViewModel>("GetCachedStatus");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using JdeScoping.Core.ApiContracts.SignalR;
|
||||
using JdeScoping.Core.ViewModels;
|
||||
|
||||
namespace JdeScoping.Client.Services;
|
||||
|
||||
@@ -10,12 +10,12 @@ public interface IHubConnectionService
|
||||
/// <summary>
|
||||
/// Event fired when a search update is received.
|
||||
/// </summary>
|
||||
event Action<SearchUpdateDto>? OnSearchUpdate;
|
||||
event Action<SearchUpdateViewModel>? OnSearchUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when a processor status update is received.
|
||||
/// </summary>
|
||||
event Action<StatusUpdateDto>? OnStatusUpdate;
|
||||
event Action<StatusUpdateViewModel>? OnStatusUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Starts the SignalR connection.
|
||||
@@ -30,7 +30,7 @@ public interface IHubConnectionService
|
||||
/// <summary>
|
||||
/// Gets the cached processor status from the server.
|
||||
/// </summary>
|
||||
Task<StatusUpdateDto?> GetCachedStatusAsync();
|
||||
Task<StatusUpdateViewModel?> GetCachedStatusAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current connection state.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using JdeScoping.Client.Models;
|
||||
using JdeScoping.Core.Models.Infrastructure;
|
||||
|
||||
namespace JdeScoping.Client.Services;
|
||||
|
||||
@@ -10,5 +10,5 @@ public interface IRefreshStatusService
|
||||
/// <summary>
|
||||
/// Gets refresh status records within the specified date range.
|
||||
/// </summary>
|
||||
Task<List<DataUpdateViewModel>> GetRefreshStatusAsync(DateTime minDt, DateTime maxDt);
|
||||
Task<List<DataUpdateDto>> GetRefreshStatusAsync(DateTime minDt, DateTime maxDt);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using JdeScoping.Core.ApiContracts;
|
||||
using JdeScoping.Core.ApiContracts.Pipelines;
|
||||
using JdeScoping.Core.Models.Pipelines;
|
||||
using JdeScoping.Core.ApiContracts.Results;
|
||||
|
||||
namespace JdeScoping.Client.Services;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Net.Http.Json;
|
||||
using JdeScoping.Client.Models;
|
||||
using JdeScoping.Core.Models.Infrastructure;
|
||||
|
||||
namespace JdeScoping.Client.Services;
|
||||
|
||||
@@ -16,13 +16,13 @@ public class RefreshStatusService : IRefreshStatusService
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public async Task<List<DataUpdateViewModel>> GetRefreshStatusAsync(DateTime minDt, DateTime maxDt)
|
||||
public async Task<List<DataUpdateDto>> GetRefreshStatusAsync(DateTime minDt, DateTime maxDt)
|
||||
{
|
||||
try
|
||||
{
|
||||
var minDtStr = minDt.ToString("yyyy-MM-dd");
|
||||
var maxDtStr = maxDt.ToString("yyyy-MM-dd");
|
||||
var result = await _httpClient.GetFromJsonAsync<List<DataUpdateViewModel>>(
|
||||
var result = await _httpClient.GetFromJsonAsync<List<DataUpdateDto>>(
|
||||
$"api/refresh-status?minDT={minDtStr}&maxDT={maxDtStr}");
|
||||
return result ?? [];
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
@using JdeScoping.Client.Models
|
||||
@using JdeScoping.Client.Pages
|
||||
@using JdeScoping.Client.Services
|
||||
@using JdeScoping.Core.ApiContracts.Auth
|
||||
@using JdeScoping.Core.ApiContracts.SignalR
|
||||
@using JdeScoping.Core.ApiContracts
|
||||
@using JdeScoping.Core.Models.Auth
|
||||
@using JdeScoping.Core.Models.Infrastructure
|
||||
@using JdeScoping.Core.Models.Pipelines
|
||||
@using JdeScoping.Core.ViewModels
|
||||
@using ClientSearchViewModel = JdeScoping.Client.Models.SearchViewModel
|
||||
|
||||
Reference in New Issue
Block a user