feat(AppVersion): Add BFF handler for AppVersion
Build and Deploy to Production / build-and-deploy (push) Successful in 2m49s
Build and Deploy to Production / build-and-deploy (push) Successful in 2m49s
- Add GetAppVersionQuery and Handler in Application layer - Add AppVersionGrpcService in WebApi - Add AppVersion to IApplicationContractContext and ApplicationContractContext - Update CMSMicroservice.Protobuf to 0.0.158
This commit is contained in:
@@ -10,6 +10,7 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
|
|||||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||||
using CMSMicroservice.Protobuf.Protos.Configuration;
|
using CMSMicroservice.Protobuf.Protos.Configuration;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.AppVersion;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserContract;
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
@@ -63,6 +64,9 @@ public interface IApplicationContractContext
|
|||||||
|
|
||||||
// Geography System (GMS)
|
// Geography System (GMS)
|
||||||
CityContract.CityContractClient Cities { get; }
|
CityContract.CityContractClient Cities { get; }
|
||||||
|
|
||||||
|
// App Version System
|
||||||
|
AppVersionContract.AppVersionContractClient AppVersion { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PYMS
|
#region PYMS
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
using FrontOffice.BFF.Configuration.Protobuf.Protos.AppVersion;
|
||||||
|
|
||||||
|
namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت نسخه اپلیکیشن برای بررسی نیاز به پاک کردن کش
|
||||||
|
/// </summary>
|
||||||
|
public record GetAppVersionQuery(string AppName, string? CurrentClientVersion) : IRequest<GetAppVersionResponseDto>;
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
using CMSMicroservice.Protobuf.Protos.AppVersion;
|
||||||
|
|
||||||
|
namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// هندلر دریافت نسخه اپلیکیشن از CMS
|
||||||
|
/// </summary>
|
||||||
|
public class GetAppVersionQueryHandler : IRequestHandler<GetAppVersionQuery, GetAppVersionResponseDto>
|
||||||
|
{
|
||||||
|
private readonly IApplicationContractContext _context;
|
||||||
|
|
||||||
|
public GetAppVersionQueryHandler(IApplicationContractContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetAppVersionResponseDto> Handle(GetAppVersionQuery request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var cmsRequest = new GetAppVersionRequest
|
||||||
|
{
|
||||||
|
AppName = request.AppName
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.CurrentClientVersion))
|
||||||
|
{
|
||||||
|
cmsRequest.CurrentClientVersion = request.CurrentClientVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await _context.AppVersion.GetAppVersionAsync(cmsRequest, cancellationToken: cancellationToken);
|
||||||
|
|
||||||
|
return new GetAppVersionResponseDto
|
||||||
|
{
|
||||||
|
Found = response.Found,
|
||||||
|
AppName = response.AppName,
|
||||||
|
CurrentVersion = response.CurrentVersion,
|
||||||
|
MinRequiredVersion = response.MinRequiredVersion,
|
||||||
|
RequiresFullCacheClear = response.RequiresFullCacheClear,
|
||||||
|
RequiresUpdate = response.RequiresUpdate,
|
||||||
|
UpdateMessage = response.UpdateMessage,
|
||||||
|
ReleaseNotes = response.ReleaseNotes,
|
||||||
|
LastUpdated = response.LastUpdated?.ToDateTime()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DTO پاسخ نسخه اپلیکیشن
|
||||||
|
/// </summary>
|
||||||
|
public class GetAppVersionResponseDto
|
||||||
|
{
|
||||||
|
public bool Found { get; set; }
|
||||||
|
public string AppName { get; set; } = string.Empty;
|
||||||
|
public string CurrentVersion { get; set; } = string.Empty;
|
||||||
|
public string MinRequiredVersion { get; set; } = string.Empty;
|
||||||
|
public bool RequiresFullCacheClear { get; set; }
|
||||||
|
public bool RequiresUpdate { get; set; }
|
||||||
|
public string? UpdateMessage { get; set; }
|
||||||
|
public string? ReleaseNotes { get; set; }
|
||||||
|
public DateTime? LastUpdated { get; set; }
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<ProjectReference Include="..\FrontOffice.BFF.Domain\FrontOffice.BFF.Domain.csproj" />
|
<ProjectReference Include="..\FrontOffice.BFF.Domain\FrontOffice.BFF.Domain.csproj" />
|
||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
|
||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Category.Protobuf\FrontOffice.BFF.Category.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Category.Protobuf\FrontOffice.BFF.Category.Protobuf.csproj" />
|
||||||
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Configuration.Protobuf\FrontOffice.BFF.Configuration.Protobuf.csproj" />
|
||||||
<!-- CMS Protobuf for Commission, ClubMembership, NetworkMembership, Configuration -->
|
<!-- CMS Protobuf for Commission, ClubMembership, NetworkMembership, Configuration -->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
|
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.156" />
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.158" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
|
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.76.0">
|
<PackageReference Include="Grpc.Tools" Version="2.76.0">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
|
|||||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||||
using CMSMicroservice.Protobuf.Protos.Configuration;
|
using CMSMicroservice.Protobuf.Protos.Configuration;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.AppVersion;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserContract;
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
@@ -90,6 +91,9 @@ public class ApplicationContractContext : IApplicationContractContext
|
|||||||
|
|
||||||
// Geography System (GMS)
|
// Geography System (GMS)
|
||||||
public CityContract.CityContractClient Cities => GetService<CityContract.CityContractClient>();
|
public CityContract.CityContractClient Cities => GetService<CityContract.CityContractClient>();
|
||||||
|
|
||||||
|
// App Version System
|
||||||
|
public AppVersionContract.AppVersionContractClient AppVersion => GetService<AppVersionContract.AppVersionContractClient>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PYMS
|
#region PYMS
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using FrontOffice.BFF.WebApi.Common.Services;
|
||||||
|
using FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
|
||||||
|
using FrontOffice.BFF.Configuration.Protobuf.Protos.AppVersion;
|
||||||
|
|
||||||
|
namespace FrontOffice.BFF.WebApi.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// سرویس نسخه اپلیکیشن - برای بررسی نیاز به پاک کردن کش
|
||||||
|
/// </summary>
|
||||||
|
public class AppVersionGrpcService : AppVersionContract.AppVersionContractBase
|
||||||
|
{
|
||||||
|
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||||
|
|
||||||
|
public AppVersionGrpcService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||||
|
{
|
||||||
|
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت نسخه اپلیکیشن
|
||||||
|
/// </summary>
|
||||||
|
public override async Task<GetAppVersionResponse> GetAppVersion(GetAppVersionRequest request, ServerCallContext context)
|
||||||
|
{
|
||||||
|
return await _dispatchRequestToCQRS.Handle<GetAppVersionRequest, GetAppVersionQuery, GetAppVersionResponse>(request, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user