diff --git a/src/FrontOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs b/src/FrontOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs
index 57e6112..32fe233 100644
--- a/src/FrontOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs
+++ b/src/FrontOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs
@@ -10,6 +10,7 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
using CMSMicroservice.Protobuf.Protos.UserCarts;
using CMSMicroservice.Protobuf.Protos.Commission;
using CMSMicroservice.Protobuf.Protos.Configuration;
+using CMSMicroservice.Protobuf.Protos.AppVersion;
using CMSMicroservice.Protobuf.Protos.UserContract;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserWallet;
@@ -63,6 +64,9 @@ public interface IApplicationContractContext
// Geography System (GMS)
CityContract.CityContractClient Cities { get; }
+
+ // App Version System
+ AppVersionContract.AppVersionContractClient AppVersion { get; }
#endregion
#region PYMS
diff --git a/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQuery.cs b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQuery.cs
new file mode 100644
index 0000000..5da6dde
--- /dev/null
+++ b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQuery.cs
@@ -0,0 +1,8 @@
+using FrontOffice.BFF.Configuration.Protobuf.Protos.AppVersion;
+
+namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
+
+///
+/// دریافت نسخه اپلیکیشن برای بررسی نیاز به پاک کردن کش
+///
+public record GetAppVersionQuery(string AppName, string? CurrentClientVersion) : IRequest;
diff --git a/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs
new file mode 100644
index 0000000..fe3dad7
--- /dev/null
+++ b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs
@@ -0,0 +1,44 @@
+using CMSMicroservice.Protobuf.Protos.AppVersion;
+
+namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
+
+///
+/// هندلر دریافت نسخه اپلیکیشن از CMS
+///
+public class GetAppVersionQueryHandler : IRequestHandler
+{
+ private readonly IApplicationContractContext _context;
+
+ public GetAppVersionQueryHandler(IApplicationContractContext context)
+ {
+ _context = context;
+ }
+
+ public async Task 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()
+ };
+ }
+}
diff --git a/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionResponseDto.cs b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionResponseDto.cs
new file mode 100644
index 0000000..448964a
--- /dev/null
+++ b/src/FrontOffice.BFF.Application/ConfigurationCQ/Queries/GetAppVersion/GetAppVersionResponseDto.cs
@@ -0,0 +1,17 @@
+namespace FrontOffice.BFF.Application.ConfigurationCQ.Queries.GetAppVersion;
+
+///
+/// DTO پاسخ نسخه اپلیکیشن
+///
+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; }
+}
diff --git a/src/FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj b/src/FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj
index 5011442..3c821aa 100644
--- a/src/FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj
+++ b/src/FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj
@@ -15,6 +15,7 @@
+
diff --git a/src/FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj b/src/FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj
index 3e4d5e7..80859b8 100644
--- a/src/FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj
+++ b/src/FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/FrontOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs b/src/FrontOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs
index 0ec3139..dfb174f 100644
--- a/src/FrontOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs
+++ b/src/FrontOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs
@@ -10,6 +10,7 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
using CMSMicroservice.Protobuf.Protos.UserCarts;
using CMSMicroservice.Protobuf.Protos.Commission;
using CMSMicroservice.Protobuf.Protos.Configuration;
+using CMSMicroservice.Protobuf.Protos.AppVersion;
using CMSMicroservice.Protobuf.Protos.UserContract;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserWallet;
@@ -90,6 +91,9 @@ public class ApplicationContractContext : IApplicationContractContext
// Geography System (GMS)
public CityContract.CityContractClient Cities => GetService();
+
+ // App Version System
+ public AppVersionContract.AppVersionContractClient AppVersion => GetService();
#endregion
#region PYMS
diff --git a/src/FrontOffice.BFF.WebApi/Services/AppVersionGrpcService.cs b/src/FrontOffice.BFF.WebApi/Services/AppVersionGrpcService.cs
new file mode 100644
index 0000000..6633bb9
--- /dev/null
+++ b/src/FrontOffice.BFF.WebApi/Services/AppVersionGrpcService.cs
@@ -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;
+
+///
+/// سرویس نسخه اپلیکیشن - برای بررسی نیاز به پاک کردن کش
+///
+public class AppVersionGrpcService : AppVersionContract.AppVersionContractBase
+{
+ private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
+
+ public AppVersionGrpcService(IDispatchRequestToCQRS dispatchRequestToCQRS)
+ {
+ _dispatchRequestToCQRS = dispatchRequestToCQRS;
+ }
+
+ ///
+ /// دریافت نسخه اپلیکیشن
+ ///
+ public override async Task GetAppVersion(GetAppVersionRequest request, ServerCallContext context)
+ {
+ return await _dispatchRequestToCQRS.Handle(request, context);
+ }
+}