Skip to content

Commit

Permalink
Merge branch 'main' into juj/IncreaseLimitOnMeteringPointTimeSeries
Browse files Browse the repository at this point in the history
  • Loading branch information
FirestarJes authored Sep 25, 2024
2 parents 2a4e6dc + 3a2f2f1 commit 3c75f94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ await _revisionLogClient.LogAsync(
payload: System.Text.Json.JsonSerializer.Serialize(settlementReportRequest)))
.ConfigureAwait(false);

var actorNumber = _userContext.CurrentUser.Actor.ActorNumber;
var marketRole = _userContext.CurrentUser.Actor.MarketRole switch
{
FrontendActorMarketRole.Other => MarketRole.Other,
Expand All @@ -75,9 +76,10 @@ await _revisionLogClient.LogAsync(
};

if (_userContext.CurrentUser is { MultiTenancy: true, Actor.MarketRole: FrontendActorMarketRole.DataHubAdministrator } &&
settlementReportRequest.MarketRoleOverride.HasValue)
settlementReportRequest is { MarketRoleOverride: not null, ActorNumberOverride: not null })
{
marketRole = settlementReportRequest.MarketRoleOverride.Value;
actorNumber = settlementReportRequest.ActorNumberOverride;
}

if (marketRole == MarketRole.EnergySupplier && string.IsNullOrWhiteSpace(settlementReportRequest.Filter.EnergySupplier))
Expand All @@ -103,7 +105,7 @@ await _revisionLogClient.LogAsync(
}

var chargeOwnerId = marketRole is MarketRole.GridAccessProvider or MarketRole.SystemOperator
? _userContext.CurrentUser.Actor.ActorNumber
? actorNumber
: null;

var actorInfo = new SettlementReportRequestedByActor(marketRole, chargeOwnerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public sealed record SettlementReportRequestDto(
bool IncludeBasisData,
bool IncludeMonthlyAmount,
SettlementReportRequestFilterDto Filter,
string? ActorNumberOverride = null,
MarketRole? MarketRoleOverride = null);
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public SettlementReportsController(
[EnableRevision(activityName: "RequestSettlementReportAPI", entityType: typeof(SettlementReportRequestDto))]
public async Task<ActionResult<long>> RequestSettlementReport([FromBody] SettlementReportRequestDto settlementReportRequest)
{
var actorNumber = _userContext.CurrentUser.Actor.ActorNumber;
var marketRole = _userContext.CurrentUser.Actor.MarketRole switch
{
FrontendActorMarketRole.Other => MarketRole.Other,
Expand All @@ -65,9 +66,10 @@ public async Task<ActionResult<long>> RequestSettlementReport([FromBody] Settlem
};

if (_userContext.CurrentUser is { MultiTenancy: true, Actor.MarketRole: FrontendActorMarketRole.DataHubAdministrator } &&
settlementReportRequest.MarketRoleOverride.HasValue)
settlementReportRequest is { MarketRoleOverride: not null, ActorNumberOverride: not null })
{
marketRole = settlementReportRequest.MarketRoleOverride.Value;
actorNumber = settlementReportRequest.ActorNumberOverride;
}

if (marketRole == MarketRole.EnergySupplier && string.IsNullOrWhiteSpace(settlementReportRequest.Filter.EnergySupplier))
Expand Down Expand Up @@ -97,7 +99,7 @@ public async Task<ActionResult<long>> RequestSettlementReport([FromBody] Settlem
_userContext.CurrentUser.UserId,
_userContext.CurrentUser.Actor.ActorId,
_userContext.CurrentUser.MultiTenancy,
_userContext.CurrentUser.Actor.ActorNumber,
actorNumber,
marketRole);

var result = await _requestSettlementReportJobHandler.HandleAsync(requestCommand).ConfigureAwait(false);
Expand Down

0 comments on commit 3c75f94

Please sign in to comment.