Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ jobs:

steps:
- uses: actions/[email protected]


- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

Expand All @@ -40,6 +45,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Trust Certificate
run: |
sudo apt-get install expect
Expand Down Expand Up @@ -94,6 +104,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Trust Certificate
run: |
sudo apt-get install expect
Expand Down Expand Up @@ -148,6 +163,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Trust Certificate
run: |
sudo apt-get install expect
Expand Down
4 changes: 2 additions & 2 deletions EstateManagementUI.BusinessLogic.Tests/ApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public async Task ApiClient_GetOperators_ClientCallFailed_ResultFailed() {
public async Task ApiClient_GetOperator_OperatorIsReturned() {
this.TransactionProcessorClient.Setup(e => e.GetOperator(It.IsAny<String>(), It.IsAny<Guid>(), It.IsAny<Guid>(), It.IsAny<CancellationToken>())).ReturnsAsync(Result.Success(TestData.OperatorResponse));

OperatorModel @operator = await this.ApiClient.GetOperator(TestData.AccessToken, Guid.NewGuid(), TestData.EstateId, TestData.Operator1Id, CancellationToken.None);

Result<OperatorModel> @operator = await this.ApiClient.GetOperator(TestData.AccessToken, Guid.NewGuid(), TestData.EstateId, TestData.Operator1Id, CancellationToken.None);
@operator.IsSuccess.ShouldBeTrue();
@operator.ShouldNotBeNull();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DebugType>None</DebugType>
Expand All @@ -10,13 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lamar" Version="14.0.1" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Lamar" Version="15.0.0" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="MediatR.Contracts" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
Expand Down
82 changes: 46 additions & 36 deletions EstateManagementUI.BusinessLogic/Clients/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,13 @@ public async Task<Result<List<ComparisonDateModel>>> GetComparisonDates(String a
async Task<Result<List<ComparisonDateModel>>> ClientMethod()
{

List<ComparisonDate> apiResponse = await this.EstateReportingApiClient.GetComparisonDates(accessToken, estateId, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<List<ComparisonDate>> apiResponse = await this.EstateReportingApiClient.GetComparisonDates(accessToken, estateId, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
//List<ComparisonDate> apiResponse = await this.EstateReportingApiClient.GetComparisonDates(accessToken, estateId, cancellationToken);

//return Result.Success(ModelFactory.ConvertFrom(apiResponse));
}

public async Task<Result<TodaysSalesModel>> GetTodaysSales(String accessToken,
Expand All @@ -313,9 +311,10 @@ public async Task<Result<TodaysSalesModel>> GetTodaysSales(String accessToken,
DateTime comparisonDate,
CancellationToken cancellationToken) {
async Task<Result<TodaysSalesModel>> ClientMethod() {
TodaysSales apiResponse = await this.EstateReportingApiClient.GetTodaysSales(accessToken, estateId, merchantReportingId.GetValueOrDefault(0), operatorReportingId.GetValueOrDefault(0), comparisonDate, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<TodaysSales> apiResponse = await this.EstateReportingApiClient.GetTodaysSales(accessToken, estateId, merchantReportingId.GetValueOrDefault(0), operatorReportingId.GetValueOrDefault(0), comparisonDate, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -329,9 +328,10 @@ public async Task<Result<TodaysSettlementModel>> GetTodaysSettlement(String acce
DateTime comparisonDate,
CancellationToken cancellationToken) {
async Task<Result<TodaysSettlementModel>> ClientMethod() {
TodaysSettlement apiResponse = await this.EstateReportingApiClient.GetTodaysSettlement(accessToken, estateId, merchantReportingId.GetValueOrDefault(0), operatorReportingId.GetValueOrDefault(0), comparisonDate, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<TodaysSettlement> apiResponse = await this.EstateReportingApiClient.GetTodaysSettlement(accessToken, estateId, merchantReportingId.GetValueOrDefault(0), operatorReportingId.GetValueOrDefault(0), comparisonDate, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -345,9 +345,11 @@ public async Task<Result<List<TodaysSalesCountByHourModel>>> GetTodaysSalesCount
DateTime comparisonDate,
CancellationToken cancellationToken) {
async Task<Result<List<TodaysSalesCountByHourModel>>> ClientMethod() {
List<TodaysSalesCountByHour> apiResponse = await this.EstateReportingApiClient.GetTodaysSalesCountByHour(accessToken, estateId, 0, 0, comparisonDate, cancellationToken);
Result<List<TodaysSalesCountByHour>> apiResponse = await this.EstateReportingApiClient.GetTodaysSalesCountByHour(accessToken, estateId, 0, 0, comparisonDate, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -361,9 +363,11 @@ public async Task<Result<List<TodaysSalesValueByHourModel>>> GetTodaysSalesValue
DateTime comparisonDate,
CancellationToken cancellationToken) {
async Task<Result<List<TodaysSalesValueByHourModel>>> ClientMethod() {
List<TodaysSalesValueByHour> apiResponse = await this.EstateReportingApiClient.GetTodaysSalesValueByHour(accessToken, estateId, 0, 0, comparisonDate, cancellationToken);
Result<List<TodaysSalesValueByHour>> apiResponse = await this.EstateReportingApiClient.GetTodaysSalesValueByHour(accessToken, estateId, 0, 0, comparisonDate, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -373,7 +377,7 @@ private async Task<Result<T>> CallClientMethod<T>(Func<Task<Result<T>>> clientMe
CancellationToken cancellationToken) {
try {
Result<T> clientResult = await clientMethod();
return Result.Success(clientResult);
return clientResult;
}
catch (Exception e) {
Logger.LogError(e);
Expand All @@ -385,7 +389,7 @@ private async Task<Result> CallClientMethod(Func<Task<Result>> clientMethod,
CancellationToken cancellationToken) {
try {
Result clientResult = await clientMethod();
return Result.Success(clientResult);
return clientResult;
}
catch (Exception e) {
Logger.LogError(e);
Expand All @@ -399,9 +403,10 @@ public async Task<Result<TodaysSalesModel>> GetTodaysFailedSales(String accessTo
DateTime comparisonDate,
CancellationToken cancellationToken) {
async Task<Result<TodaysSalesModel>> ClientMethod() {
TodaysSales apiResponse = await this.EstateReportingApiClient.GetTodaysFailedSales(accessToken, estateId, 0, 0, responseCode, comparisonDate, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<TodaysSales> apiResponse = await this.EstateReportingApiClient.GetTodaysFailedSales(accessToken, estateId, 0, 0, responseCode, comparisonDate, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -413,9 +418,10 @@ public async Task<Result<List<TopBottomOperatorDataModel>>> GetTopBottomOperator
Int32 resultCount,
CancellationToken cancellationToken) {
async Task<Result<List<TopBottomOperatorDataModel>>> ClientMethod() {
List<TopBottomOperatorData> apiResponse = await this.EstateReportingApiClient.GetTopBottomOperatorData(accessToken, estateId, topBottom, resultCount, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<List<TopBottomOperatorData>> apiResponse = await this.EstateReportingApiClient.GetTopBottomOperatorData(accessToken, estateId, topBottom, resultCount, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -427,9 +433,10 @@ public async Task<Result<List<TopBottomMerchantDataModel>>> GetTopBottomMerchant
Int32 resultCount,
CancellationToken cancellationToken) {
async Task<Result<List<TopBottomMerchantDataModel>>> ClientMethod() {
List<TopBottomMerchantData> apiResponse = await this.EstateReportingApiClient.GetTopBottomMerchantData(accessToken, estateId, topBottom, resultCount, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<List<TopBottomMerchantData>> apiResponse = await this.EstateReportingApiClient.GetTopBottomMerchantData(accessToken, estateId, topBottom, resultCount, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -441,9 +448,10 @@ public async Task<Result<List<TopBottomProductDataModel>>> GetTopBottomProductDa
Int32 resultCount,
CancellationToken cancellationToken) {
async Task<Result<List<TopBottomProductDataModel>>> ClientMethod() {
List<TopBottomProductData> apiResponse = await this.EstateReportingApiClient.GetTopBottomProductData(accessToken, estateId, topBottom, resultCount, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<List<TopBottomProductData>> apiResponse = await this.EstateReportingApiClient.GetTopBottomProductData(accessToken, estateId, topBottom, resultCount, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -453,9 +461,10 @@ public async Task<Result<MerchantKpiModel>> GetMerchantKpi(String accessToken,
Guid estateId,
CancellationToken cancellationToken) {
async Task<Result<MerchantKpiModel>> ClientMethod() {
MerchantKpi apiResponse = await this.EstateReportingApiClient.GetMerchantKpi(accessToken, estateId, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<MerchantKpi> apiResponse = await this.EstateReportingApiClient.GetMerchantKpi(accessToken, estateId, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand All @@ -474,9 +483,10 @@ public async Task<Result<LastSettlementModel>> GetLastSettlement(String accessTo
Int32? operatorReportingId,
CancellationToken cancellationToken) {
async Task<Result<LastSettlementModel>> ClientMethod() {
LastSettlement apiResponse = await this.EstateReportingApiClient.GetLastSettlement(accessToken, estateId, cancellationToken);

return ModelFactory.ConvertFrom(apiResponse);
Result<LastSettlement> apiResponse = await this.EstateReportingApiClient.GetLastSettlement(accessToken, estateId, cancellationToken);
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);
return ModelFactory.ConvertFrom(apiResponse.Data);
}

return await this.CallClientMethod(ClientMethod, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FileProcessor.Client" Version="2025.2.1" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.14">
<PackageReference Include="FileProcessor.Client" Version="2025.3.2-build79" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.14">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Shared" Version="2025.3.1" />
<PackageReference Include="SimpleResults" Version="3.0.1" />
<PackageReference Include="Shared" Version="2025.6.2" />
<PackageReference Include="SimpleResults" Version="4.0.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="EstateReportingAPI.Client" Version="2025.2.2-build62" />
<PackageReference Include="TransactionProcessor.Client" Version="2025.2.10" />
<PackageReference Include="EstateReportingAPI.Client" Version="2025.3.2-build66" />
<PackageReference Include="TransactionProcessor.Client" Version="2025.5.2-build186" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ public PermissionsService(IPermissionsRepository permissionsRepository, IConfigu

private async Task LoadPermissionsData() {
// TODO: this will be cached and probably refreshed periodically
this.RoleFunctions = await this.PermissionsRepository.GetRolesFunctions();
this.UserRoles= await this.PermissionsRepository.GetUsers(CancellationToken.None);
var roleResult = await this.PermissionsRepository.GetRolesFunctions();
if (roleResult.IsFailed) {
// TODO : Handle error properly, e.g., log it or throw an exception
}
var userResult = await this.PermissionsRepository.GetUsers(CancellationToken.None);
if (userResult.IsFailed)
{
// TODO : Handle error properly, e.g., log it or throw an exception
}

this.RoleFunctions = roleResult.Data;
this.UserRoles= userResult.Data;
}

private List<(String role, String section, String function)> RoleFunctions = new();
Expand Down
Loading
Loading