Refactor: Update Protobuf references to CMSMicroservice across multiple components
- Changed Protobuf imports from FrontOffice.BFF to CMSMicroservice in Profile components (EditAddressDialog, Index, PaymentCallback, Personal, Settings). - Updated CheckoutSummary, OrderDetail, OrderTracking, and Orders pages to use new UserOrder Protobuf definitions. - Refactored WalletService, PackageService, and other utility services to align with new Protobuf structure. - Adjusted appsettings.json for local development URL. - Removed unused validators and simplified validation logic in AuthDialog. - Enhanced ClubMembershipContractDialog to utilize new OtpToken service for OTP handling.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
|
||||
<MudDialog >
|
||||
@using CMSMicroservice.Protobuf.Protos.City
|
||||
<MudDialog>
|
||||
<TitleContent>
|
||||
<MudText Typo="Typo.h4" Align="Align.Center">افزودن آدرس جدید</MudText>
|
||||
</TitleContent>
|
||||
<DialogContent>
|
||||
<MudForm @ref="_form" Model="_request" Validation="@(_validator.ValidateValue)">
|
||||
<MudForm @ref="_form" Model="_request">
|
||||
<MudStack Spacing="3">
|
||||
<MudTextField @bind-Value="_request.Title"
|
||||
For="@(() => _request.Title)"
|
||||
@@ -29,12 +30,12 @@
|
||||
Required="true"
|
||||
RequiredError="کد پستی الزامی است." />
|
||||
|
||||
<MudAutocomplete T="CityProto.GetAllCitiesByFilterResponseModel"
|
||||
<MudAutocomplete T="object"
|
||||
@bind-Value="_selectedCity"
|
||||
Label="شهر"
|
||||
Variant="Variant.Outlined"
|
||||
SearchFunc="SearchCities"
|
||||
ToStringFunc="@(city => city != null ? $"{city.Native} ({city.StateName})" : string.Empty)"
|
||||
ToStringFunc="@(city => city != null ? $"{((CMSMicroservice.Protobuf.Protos.City.CityDto)city).Native} ({((CMSMicroservice.Protobuf.Protos.City.CityDto)city).StateName})" : string.Empty)"
|
||||
Required="true"
|
||||
RequiredError="شهر الزامی است."
|
||||
Clearable="true"
|
||||
@@ -49,8 +50,8 @@
|
||||
<ItemTemplate Context="city">
|
||||
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.Center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.LocationCity" Size="Size.Small" />
|
||||
<MudText>@city.Native</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">(@city.StateName)</MudText>
|
||||
<MudText>@(((CMSMicroservice.Protobuf.Protos.City.CityDto)city).Native)</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">(@(((CMSMicroservice.Protobuf.Protos.City.CityDto)city).StateName))</MudText>
|
||||
</MudStack>
|
||||
</ItemTemplate>
|
||||
<NoItemsTemplate>
|
||||
|
||||
@@ -1,43 +1,42 @@
|
||||
using FrontOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using FrontOffice.BFF.UserAddress.Protobuf.Validator;
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
using CMSMicroservice.Protobuf.Protos.City;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using Severity = MudBlazor.Severity;
|
||||
using CityProto = FrontOffice.BFF.City.Protobuf;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Profile.Components;
|
||||
|
||||
public record CityModel(long Id, string Name);
|
||||
|
||||
public partial class AddAddressDialog : ComponentBase
|
||||
{
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!;
|
||||
[Inject] private UserAddressContract.UserAddressContractClient UserAddressContract { get; set; } = default!;
|
||||
[Inject] private CityProto.CityContract.CityContractClient CityContract { get; set; } = default!;
|
||||
[Inject] private CityContract.CityContractClient CityContract { get; set; } = default!;
|
||||
|
||||
private MudForm? _form;
|
||||
private readonly CreateNewUserAddressRequestValidator _validator = new();
|
||||
private bool _isSaving;
|
||||
private CreateNewUserAddressRequest _request = new();
|
||||
private CityProto.GetAllCitiesByFilterResponseModel? _selectedCity;
|
||||
private object? _selectedCity;
|
||||
|
||||
private async Task<IEnumerable<CityProto.GetAllCitiesByFilterResponseModel>> SearchCities(string value,
|
||||
CancellationToken ct)
|
||||
private async Task<IEnumerable<object>> SearchCities(string value, CancellationToken ct)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value) || value.Length < 2)
|
||||
return Enumerable.Empty<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
return Enumerable.Empty<object>();
|
||||
|
||||
try
|
||||
{
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new CityProto.GetAllCitiesByFilterRequest
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new GetAllCitiesByFilterRequest
|
||||
{
|
||||
PaginationState = new CityProto.PaginationState { PageNumber = 1, PageSize = 20 },
|
||||
Filter = new CityProto.GetAllCitiesByFilterFilter { Name = value }
|
||||
}, cancellationToken: ct);
|
||||
|
||||
return response?.Models?.ToList() ?? new List<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
PaginationState = new CMSMicroservice.Protobuf.Protos.City.PaginationState { PageNumber = 1, PageSize = 20 },
|
||||
Filter = new GetAllCitiesByFilterFilter { Name = value }
|
||||
});
|
||||
|
||||
return response?.Cities?.Cast<object>() ?? Enumerable.Empty<object>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Enumerable.Empty<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
return Enumerable.Empty<object>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ public partial class AddAddressDialog : ComponentBase
|
||||
return;
|
||||
}
|
||||
|
||||
_request.CityId = _selectedCity.Id;
|
||||
_request.CityId = (long)((dynamic)_selectedCity).Id;
|
||||
_isSaving = true;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@using CMSMicroservice.Protobuf.Protos.City
|
||||
<MudDialog>
|
||||
<TitleContent>
|
||||
<MudText Typo="Typo.h4" Align="Align.Center">ویرایش آدرس</MudText>
|
||||
</TitleContent>
|
||||
<DialogContent>
|
||||
<MudForm @ref="_form" Model="_request" Validation="@(_validator.ValidateValue)">
|
||||
<MudForm @ref="_form" Model="_request">
|
||||
<MudStack Spacing="3">
|
||||
<MudTextField @bind-Value="_request.Title"
|
||||
For="@(() => _request.Title)"
|
||||
@@ -28,12 +29,12 @@
|
||||
Required="true"
|
||||
RequiredError="کد پستی الزامی است." />
|
||||
|
||||
<MudAutocomplete T="CityProto.GetAllCitiesByFilterResponseModel"
|
||||
<MudAutocomplete T="object"
|
||||
@bind-Value="_selectedCity"
|
||||
Label="شهر"
|
||||
Variant="Variant.Outlined"
|
||||
SearchFunc="SearchCities"
|
||||
ToStringFunc="@(city => city != null ? $"{city.Native} ({city.StateName})" : string.Empty)"
|
||||
ToStringFunc="@(city => city != null ? $"{((CMSMicroservice.Protobuf.Protos.City.CityDto)city).Native} ({((CMSMicroservice.Protobuf.Protos.City.CityDto)city).StateName})" : string.Empty)"
|
||||
Required="true"
|
||||
RequiredError="شهر الزامی است."
|
||||
Clearable="true"
|
||||
@@ -48,8 +49,8 @@
|
||||
<ItemTemplate Context="city">
|
||||
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.Center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.LocationCity" Size="Size.Small" />
|
||||
<MudText>@city.Native</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">(@city.StateName)</MudText>
|
||||
<MudText>@(((CMSMicroservice.Protobuf.Protos.City.CityDto)city).Native)</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">(@(((CMSMicroservice.Protobuf.Protos.City.CityDto)city).StateName))</MudText>
|
||||
</MudStack>
|
||||
</ItemTemplate>
|
||||
<NoItemsTemplate>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using FrontOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using FrontOffice.BFF.UserAddress.Protobuf.Validator;
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
using CMSMicroservice.Protobuf.Protos.City;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using Severity = MudBlazor.Severity;
|
||||
using CityProto = FrontOffice.BFF.City.Protobuf;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Profile.Components;
|
||||
|
||||
@@ -12,15 +11,14 @@ public partial class EditAddressDialog : ComponentBase
|
||||
{
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!;
|
||||
[Inject] private UserAddressContract.UserAddressContractClient UserAddressContract { get; set; } = default!;
|
||||
[Inject] private CityProto.CityContract.CityContractClient CityContract { get; set; } = default!;
|
||||
[Inject] private CityContract.CityContractClient CityContract { get; set; } = default!;
|
||||
|
||||
[Parameter] public GetAllUserAddressByFilterResponseModel? Model { get; set; }
|
||||
|
||||
private MudForm? _form;
|
||||
private readonly UpdateUserAddressRequestValidator _validator = new();
|
||||
private bool _isSaving;
|
||||
private UpdateUserAddressRequest _request = new();
|
||||
private CityProto.GetAllCitiesByFilterResponseModel? _selectedCity;
|
||||
private object? _selectedCity;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@@ -41,13 +39,13 @@ public partial class EditAddressDialog : ComponentBase
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new CityProto.GetAllCitiesByFilterRequest
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new GetAllCitiesByFilterRequest
|
||||
{
|
||||
PaginationState = new CityProto.PaginationState { PageNumber = 1, PageSize = 1 },
|
||||
Filter = new CityProto.GetAllCitiesByFilterFilter { Id = cityId }
|
||||
PaginationState = new CMSMicroservice.Protobuf.Protos.City.PaginationState { PageNumber = 1, PageSize = 1 },
|
||||
Filter = new GetAllCitiesByFilterFilter { Id = cityId }
|
||||
});
|
||||
|
||||
_selectedCity = response?.Models?.FirstOrDefault();
|
||||
_selectedCity = response?.Cities?.FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -55,24 +53,24 @@ public partial class EditAddressDialog : ComponentBase
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<CityProto.GetAllCitiesByFilterResponseModel>> SearchCities(string value, CancellationToken ct)
|
||||
private async Task<IEnumerable<object>> SearchCities(string value, CancellationToken ct)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value) || value.Length < 2)
|
||||
return Enumerable.Empty<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
return Enumerable.Empty<object>();
|
||||
|
||||
try
|
||||
{
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new CityProto.GetAllCitiesByFilterRequest
|
||||
var response = await CityContract.GetAllCitiesByFilterAsync(new GetAllCitiesByFilterRequest
|
||||
{
|
||||
PaginationState = new CityProto.PaginationState { PageNumber = 1, PageSize = 20 },
|
||||
Filter = new CityProto.GetAllCitiesByFilterFilter { Native = value }
|
||||
}, cancellationToken: ct);
|
||||
|
||||
return response?.Models?.ToList() ?? new List<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
PaginationState = new CMSMicroservice.Protobuf.Protos.City.PaginationState { PageNumber = 1, PageSize = 20 },
|
||||
Filter = new GetAllCitiesByFilterFilter { Name = value }
|
||||
});
|
||||
|
||||
return response?.Cities?.Cast<object>() ?? Enumerable.Empty<object>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Enumerable.Empty<CityProto.GetAllCitiesByFilterResponseModel>();
|
||||
return Enumerable.Empty<object>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +86,7 @@ public partial class EditAddressDialog : ComponentBase
|
||||
return;
|
||||
}
|
||||
|
||||
_request.CityId = _selectedCity.Id;
|
||||
_request.CityId = (long)((dynamic)_selectedCity).Id;
|
||||
_isSaving = true;
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user