feat(bff): Add App Version management endpoints
Build and Deploy to Production / build-and-deploy (push) Successful in 1m47s
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
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using BackOffice.BFF.WebApi.Common.Services;
|
||||
using BackOffice.BFF.Application.ConfigurationCQ.Commands.UpdateAppVersion;
|
||||
using BackOffice.BFF.Application.ConfigurationCQ.Queries.GetAllAppVersions;
|
||||
using BackOffice.BFF.Configuration.Protobuf.Protos.AppVersion;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Services;
|
||||
|
||||
public class AppVersionService : AppVersionContract.AppVersionContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public AppVersionService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
|
||||
[RequiresPermission(PermissionNames.SettingsView)]
|
||||
public override async Task<GetAllAppVersionsResponse> GetAllAppVersions(
|
||||
GetAllAppVersionsRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetAllAppVersionsRequest, GetAllAppVersionsQuery, GetAllAppVersionsResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
[RequiresPermission(PermissionNames.SettingsView)]
|
||||
public override async Task<GetAppVersionResponse> GetAppVersion(
|
||||
GetAppVersionRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
// For single app version, we use GetAll and filter
|
||||
var allVersionsResponse = await _dispatchRequestToCQRS.Handle<GetAllAppVersionsRequest, GetAllAppVersionsQuery, GetAllAppVersionsResponse>(
|
||||
new GetAllAppVersionsRequest { IncludeInactive = false },
|
||||
context);
|
||||
|
||||
var item = allVersionsResponse.Items.FirstOrDefault(x => x.AppName == request.AppName);
|
||||
|
||||
return new GetAppVersionResponse
|
||||
{
|
||||
Found = item != null,
|
||||
Item = item
|
||||
};
|
||||
}
|
||||
|
||||
[RequiresPermission(PermissionNames.SettingsManageConfiguration)]
|
||||
public override async Task<Empty> UpdateAppVersion(
|
||||
UpdateAppVersionRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<UpdateAppVersionRequest, UpdateAppVersionCommand, Empty>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user