6bc45e4486
Build and Deploy to Production / build-and-deploy (push) Successful in 1m47s
- Add appversion.proto with GetAll, Get, Update RPCs - Add GetAllAppVersionsQuery and handler - Add UpdateAppVersionCommand and handler - Add AppVersionService gRPC service - Add AppVersionProfile for Mapster mappings - Update IApplicationContractContext with AppVersions client - Bump Configuration.Protobuf to 1.0.20
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using CMSMicroservice.Protobuf.Protos.AppVersion;
|
|
|
|
namespace BackOffice.BFF.Application.ConfigurationCQ.Commands.UpdateAppVersion;
|
|
|
|
public class UpdateAppVersionCommandHandler : IRequestHandler<UpdateAppVersionCommand, Unit>
|
|
{
|
|
private readonly IApplicationContractContext _context;
|
|
|
|
public UpdateAppVersionCommandHandler(IApplicationContractContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<Unit> Handle(UpdateAppVersionCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var cmsRequest = new UpdateAppVersionRequest
|
|
{
|
|
AppName = request.AppName,
|
|
CurrentVersion = request.CurrentVersion,
|
|
RequiresFullCacheClear = request.RequiresFullCacheClear
|
|
};
|
|
|
|
if (!string.IsNullOrEmpty(request.MinRequiredVersion))
|
|
cmsRequest.MinRequiredVersion = request.MinRequiredVersion;
|
|
|
|
if (!string.IsNullOrEmpty(request.UpdateMessage))
|
|
cmsRequest.UpdateMessage = request.UpdateMessage;
|
|
|
|
if (!string.IsNullOrEmpty(request.ReleaseNotes))
|
|
cmsRequest.ReleaseNotes = request.ReleaseNotes;
|
|
|
|
if (!string.IsNullOrEmpty(request.UpdateReason))
|
|
cmsRequest.UpdateReason = request.UpdateReason;
|
|
|
|
await _context.AppVersions.UpdateAppVersionAsync(cmsRequest, cancellationToken: cancellationToken);
|
|
|
|
return Unit.Value;
|
|
}
|
|
}
|