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:
+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; }
|
||||
}
|
||||
Reference in New Issue
Block a user