Skip to content

Commit

Permalink
Refactored extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Feb 18, 2024
1 parent 657c9e3 commit 004141b
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/AncillaryApplication/AncillaryApplication.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using AncillaryApplication.Persistence;
using AncillaryApplication.Persistence.ReadModels;
using AncillaryDomain;
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Persistence.Interfaces;
using Application.Persistence.Shared;
Expand Down Expand Up @@ -63,7 +63,7 @@ public AncillaryApplication(IRecorder recorder, IIdentifierFactory idFactory,
_emailDeliveryRepository = emailDeliveryRepository;
}
#endif

public async Task<Result<bool, Error>> DeliverEmailAsync(ICallerContext context, string messageAsJson,
CancellationToken cancellationToken)
{
Expand Down
44 changes: 44 additions & 0 deletions src/AncillaryApplication/FeatureFlagsApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Application.Common.Extensions;
using Application.Interfaces;
using Common;
using Common.FeatureFlags;

namespace AncillaryApplication;

public class FeatureFlagsApplication : IFeatureFlagsApplication
{
private readonly IFeatureFlags _featureFlags;

private readonly IRecorder _recorder;

public FeatureFlagsApplication(IRecorder recorder, IFeatureFlags featureFlags)
{
_recorder = recorder;

_featureFlags = featureFlags;
}

public async Task<Result<List<FeatureFlag>, Error>> GetAllFeatureFlagsAsync(ICallerContext context,
CancellationToken cancellationToken)
{
var flags = await _featureFlags.GetAllFlagsAsync(cancellationToken);

_recorder.TraceInformation(context.ToCall(), "Feature flags were retrieved");

return flags.Value.ToList();
}

public async Task<Result<FeatureFlag, Error>> GetFeatureFlagAsync(ICallerContext context, string name,
string? tenantId, string? userId, CancellationToken cancellationToken)
{
var flag = await _featureFlags.GetFlagAsync(new Flag(name), tenantId, userId, cancellationToken);
if (!flag.IsSuccessful)
{
return flag.Error;
}

_recorder.TraceInformation(context.ToCall(), "Feature flag {Name} was retrieved", name);

return flag.Value;
}
}
2 changes: 1 addition & 1 deletion src/AncillaryApplication/RecordingApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Common;
using Common.Extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Persistence.Shared;
using Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Persistence.Shared;
using Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Application.Common.Extensions;
using Application.Interfaces;
using Common;
using Domain.Common.ValueObjects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Common.Extensions;
using Domain.Common.ValueObjects;

namespace Application.Common;
namespace Application.Common.Extensions;

public static class CallerContextExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/BookingsApplication/BookingsApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Application.Services.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/CarsApplication/CarsApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using CarsApplication.Persistence;
Expand Down
2 changes: 1 addition & 1 deletion src/EndUsersApplication/EndUsersApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Common;
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityApplication/AuthTokensApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Application.Services.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityApplication/MachineCredentialsApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Application.Services.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityApplication/PasswordCredentialsApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Application.Services.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityApplication/SingleSignOnApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Application.Services.Shared;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Persistence.Shared;
using Application.Persistence.Shared.ReadModels;
Expand All @@ -12,8 +12,8 @@ namespace Infrastructure.Shared.ApplicationServices;
/// </summary>
public class QueuingEmailSchedulingService : IEmailSchedulingService
{
private readonly IRecorder _recorder;
private readonly IEmailMessageQueue _queue;
private readonly IRecorder _recorder;

public QueuingEmailSchedulingService(IRecorder recorder, IEmailMessageQueue queue)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure.Web.Api.Common/ApiUsageFilter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Diagnostics;
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Interfaces.Resources;
using Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Common.Extensions;
using Infrastructure.Web.Api.Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Security.Claims;
using System.Text.Encodings.Web;
using Application.Common;
using Application.Common.Extensions;
using Application.Services.Shared;
using Common;
using Common.Extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Security.Claims;
using System.Text.Encodings.Web;
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces.Services;
using Common;
using Common.Extensions;
Expand Down
1 change: 1 addition & 0 deletions src/Infrastructure.Workers.Api/ServiceClientExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Persistence.Interfaces;
using Common;
using Common.Recording;
Expand Down
2 changes: 1 addition & 1 deletion src/WebsiteHost/Application/AuthenticationApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Common;
Expand Down
2 changes: 1 addition & 1 deletion src/WebsiteHost/Application/RecordingApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common;
using Application.Common.Extensions;
using Application.Interfaces;
using Application.Resources.Shared;
using Common;
Expand Down

0 comments on commit 004141b

Please sign in to comment.