Skip to content

Commit 179541e

Browse files
committed
DSI-8678 Moved classes to right namespaces
1 parent 8163f59 commit 179541e

14 files changed

Lines changed: 63 additions & 61 deletions

File tree

src/Dfe.SignIn.Core.Contracts/PublicApi/GetUserAccessToService.cs renamed to src/Dfe.SignIn.Core.Contracts/Access/GetUserServiceAccessDetails.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using Dfe.SignIn.Base.Framework;
2-
using Dfe.SignIn.Core.Contracts.Access;
32

4-
namespace Dfe.SignIn.Core.Contracts.PublicApi;
3+
namespace Dfe.SignIn.Core.Contracts.Access;
54

65
/// <summary>
76
/// Request to get a user's access details for a service within an organisation.
87
/// Corresponds to the public API endpoint: GET /services/{sid}/organisations/{oid}/users/{uid}
98
/// </summary>
10-
[AssociatedResponse(typeof(GetUserAccessToServiceResponse))]
11-
public sealed record GetUserAccessToServiceRequest
9+
[AssociatedResponse(typeof(GetUserServiceAccessDetailsResponse))]
10+
public sealed record GetUserServiceAccessDetailsRequest
1211
{
1312
/// <summary>
1413
/// The unique identifier of the service.
@@ -27,9 +26,9 @@ public sealed record GetUserAccessToServiceRequest
2726
}
2827

2928
/// <summary>
30-
/// Response model for <see cref="GetUserAccessToServiceRequest"/>.
29+
/// Response model for <see cref="GetUserServiceAccessDetailsRequest"/>.
3130
/// </summary>
32-
public sealed record GetUserAccessToServiceResponse
31+
public sealed record GetUserServiceAccessDetailsResponse
3332
{
3433
/// <summary>The unique identifier of the user.</summary>
3534
public required Guid UserId { get; init; }

src/Dfe.SignIn.Core.Contracts/PublicApi/GetUserOrganisationIdentifiers.cs renamed to src/Dfe.SignIn.Core.Contracts/Users/GetUserOrganisationIdentifiers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Dfe.SignIn.Base.Framework;
22

3-
namespace Dfe.SignIn.Core.Contracts.PublicApi;
3+
namespace Dfe.SignIn.Core.Contracts.Users;
44

55
/// <summary>
66
/// Request to get the legacy numeric and text identifiers for a user within an organisation.

src/Dfe.SignIn.Core.UseCases/PublicApi/GetUserOrganisationIdentifiersUseCase.cs renamed to src/Dfe.SignIn.Core.UseCases/Users/GetUserOrganisationIdentifiersUseCase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Dfe.SignIn.Base.Framework;
2-
using Dfe.SignIn.Core.Contracts.PublicApi;
2+
using Dfe.SignIn.Core.Contracts.Users;
33
using Dfe.SignIn.Core.Entities.Organisations;
44
using Dfe.SignIn.Core.Interfaces.DataAccess;
55
using Microsoft.EntityFrameworkCore;
66

7-
namespace Dfe.SignIn.Core.UseCases.PublicApi;
7+
namespace Dfe.SignIn.Core.UseCases.Users;
88

99
/// <summary>
1010
/// Use case for retrieving the legacy numeric and text identifiers stored on the

src/Dfe.SignIn.Core.UseCases/PublicApi/GetUserAccessToServiceUseCase.cs renamed to src/Dfe.SignIn.Core.UseCases/Users/GetUserServiceAccessDetailsUseCase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Dfe.SignIn.Base.Framework;
22
using Dfe.SignIn.Core.Contracts.Access;
33
using Dfe.SignIn.Core.Contracts.Organisations;
4-
using Dfe.SignIn.Core.Contracts.PublicApi;
4+
using Dfe.SignIn.Core.Contracts.Users;
55

6-
namespace Dfe.SignIn.Core.UseCases.PublicApi;
6+
namespace Dfe.SignIn.Core.UseCases.Users;
77

88
/// <summary>
99
/// Use case for the public API "Get user access to service" endpoint.
@@ -21,13 +21,13 @@ namespace Dfe.SignIn.Core.UseCases.PublicApi;
2121
/// (via <see cref="GetOrganisationByIdRequest"/>)</item>
2222
/// </list>
2323
/// </remarks>
24-
public sealed class GetUserAccessToServiceUseCase(
24+
public sealed class GetUserServiceAccessDetailsUseCase(
2525
IInteractionDispatcher interaction
26-
) : Interactor<GetUserAccessToServiceRequest, GetUserAccessToServiceResponse>
26+
) : Interactor<GetUserServiceAccessDetailsRequest, GetUserServiceAccessDetailsResponse>
2727
{
2828
/// <inheritdoc/>
29-
public override async Task<GetUserAccessToServiceResponse> InvokeAsync(
30-
InteractionContext<GetUserAccessToServiceRequest> context,
29+
public override async Task<GetUserServiceAccessDetailsResponse> InvokeAsync(
30+
InteractionContext<GetUserServiceAccessDetailsRequest> context,
3131
CancellationToken cancellationToken = default)
3232
{
3333
context.ThrowIfHasValidationErrors();
@@ -68,7 +68,7 @@ public override async Task<GetUserAccessToServiceResponse> InvokeAsync(
6868
var userOrgIdentifiers = await userOrgIdentifiersTask;
6969
var organisation = (await organisationTask).Organisation;
7070

71-
return new GetUserAccessToServiceResponse {
71+
return new GetUserServiceAccessDetailsResponse {
7272
UserId = accessResponse.Access.UserId,
7373
UserLegacyNumericId = userOrgIdentifiers.NumericIdentifier,
7474
UserLegacyTextId = userOrgIdentifiers.TextIdentifier,

src/Dfe.SignIn.InternalApi/Configuration/PublicApiUseCaseExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Dfe.SignIn.Base.Framework;
22
using Dfe.SignIn.Core.UseCases.PublicApi;
3+
using Dfe.SignIn.Core.UseCases.Users;
34

45
namespace Dfe.SignIn.InternalApi.Configuration;
56

src/Dfe.SignIn.PublicApi.Client/Internal/GetUserAccessToServiceApiRequester.cs renamed to src/Dfe.SignIn.PublicApi.Client/Internal/GetUserServiceAccessDetailsApiRequester.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace Dfe.SignIn.PublicApi.Client.Internal;
88
// The following interactor is not exposed for use in applications until the
99
// request/response models have been properly designed.
1010

11-
internal sealed record GetUserAccessToServiceRequest
11+
internal sealed record GetUserServiceAccessDetailsRequest
1212
{
1313
public required Guid UserId { get; init; }
1414

1515
public required Guid OrganisationId { get; init; }
1616
}
1717

18-
internal sealed record GetUserAccessToServiceResponse
18+
internal sealed record GetUserServiceAccessDetailsResponse
1919
{
2020
public required IEnumerable<Role> Roles { get; init; }
2121
}
@@ -38,15 +38,15 @@ internal sealed class Status()
3838
public required int Id { get; init; }
3939
}
4040

41-
internal sealed class GetUserAccessToServiceApiRequester(
41+
internal sealed class GetUserServiceAccessDetailsApiRequester(
4242
IOptionsMonitor<JsonSerializerOptions> jsonOptionsAccessor,
4343
IOptions<PublicApiOptions> optionsAccessor,
4444
IPublicApiClient client
45-
) : Interactor<GetUserAccessToServiceRequest, GetUserAccessToServiceResponse>
45+
) : Interactor<GetUserServiceAccessDetailsRequest, GetUserServiceAccessDetailsResponse>
4646
{
4747
/// <inheritdoc/>
48-
public override async Task<GetUserAccessToServiceResponse> InvokeAsync(
49-
InteractionContext<GetUserAccessToServiceRequest> context,
48+
public override async Task<GetUserServiceAccessDetailsResponse> InvokeAsync(
49+
InteractionContext<GetUserServiceAccessDetailsRequest> context,
5050
CancellationToken cancellationToken = default)
5151
{
5252
context.ThrowIfHasValidationErrors();
@@ -63,15 +63,15 @@ public override async Task<GetUserAccessToServiceResponse> InvokeAsync(
6363
cancellationToken
6464
);
6565
if (httpResponse.StatusCode == System.Net.HttpStatusCode.NotFound) {
66-
return new GetUserAccessToServiceResponse {
66+
return new GetUserServiceAccessDetailsResponse {
6767
Roles = [],
6868
};
6969
}
7070

7171
httpResponse.EnsureSuccessStatusCode();
7272

7373
var jsonOptions = jsonOptionsAccessor.Get(JsonHelperExtensions.StandardOptionsKey);
74-
return await httpResponse.Content.ReadFromJsonAsync<GetUserAccessToServiceResponse>(
74+
return await httpResponse.Content.ReadFromJsonAsync<GetUserServiceAccessDetailsResponse>(
7575
jsonOptions, cancellationToken
7676
) ?? throw new InvalidOperationException("Invalid response.");
7777
}

src/Dfe.SignIn.PublicApi.Client/PublicApiExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private static void AddSelectOrganisationApiRequesters(IServiceCollection servic
8585

8686
// The following interactor is not exposed for use in applications until the
8787
// request/response models have been properly designed.
88-
services.AddInteractor<GetUserAccessToServiceApiRequester>();
88+
services.AddInteractor<GetUserServiceAccessDetailsApiRequester>();
8989
}
9090

9191
private static void AddUsersApiRequesters(IServiceCollection services)

src/Dfe.SignIn.PublicApi/Configuration/ServiceEndpointExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Diagnostics.CodeAnalysis;
22
using Dfe.SignIn.Base.Framework;
3-
using Dfe.SignIn.Core.UseCases.PublicApi;
3+
using Dfe.SignIn.Core.UseCases.Users;
44

55
namespace Dfe.SignIn.PublicApi.Configuration;
66

@@ -18,6 +18,6 @@ public static void SetupServiceInteractions(this IServiceCollection services)
1818
{
1919
ExceptionHelpers.ThrowIfArgumentNull(services, nameof(services));
2020

21-
services.AddInteractor<GetUserAccessToServiceUseCase>();
21+
services.AddInteractor<GetUserServiceAccessDetailsUseCase>();
2222
}
2323
}

src/Dfe.SignIn.PublicApi/Endpoints/Services/GetUserAccessToService.cs renamed to src/Dfe.SignIn.PublicApi/Endpoints/Services/GetUserServiceAccessDetails.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Dfe.SignIn.Base.Framework;
2-
using Dfe.SignIn.Core.Contracts.PublicApi;
2+
using Dfe.SignIn.Core.Contracts.Access;
33
using Microsoft.AspNetCore.Http.HttpResults;
44

55
namespace Dfe.SignIn.PublicApi.Endpoints.Services;
@@ -14,7 +14,7 @@ public static partial class ServiceEndpoints
1414
/// <para>200 with the access details when the user has access.</para>
1515
/// <para>404 when the user does not have access, or the organisation does not exist.</para>
1616
/// </returns>
17-
public static async Task<Results<Ok<GetUserAccessToServiceResponse>, NotFound>> GetUserAccessToService(
17+
public static async Task<Results<Ok<GetUserServiceAccessDetailsResponse>, NotFound>> GetUserServiceAccessDetails(
1818
Guid serviceId,
1919
Guid organisationId,
2020
Guid userId,
@@ -23,12 +23,12 @@ public static async Task<Results<Ok<GetUserAccessToServiceResponse>, NotFound>>
2323
{
2424
try {
2525
var response = await interaction.DispatchAsync(
26-
new GetUserAccessToServiceRequest {
26+
new GetUserServiceAccessDetailsRequest {
2727
ServiceId = serviceId,
2828
OrganisationId = organisationId,
2929
UserId = userId,
3030
}
31-
).To<GetUserAccessToServiceResponse>();
31+
).To<GetUserServiceAccessDetailsResponse>();
3232

3333
return TypedResults.Ok(response);
3434
}

src/Dfe.SignIn.PublicApi/Endpoints/Services/ServiceEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public static partial class ServiceEndpoints
1414
[ExcludeFromCodeCoverage]
1515
public static void UseServiceEndpoints(this WebApplication app)
1616
{
17-
app.MapGet("services/{serviceId}/organisations/{organisationId}/users/{userId}", GetUserAccessToService);
17+
app.MapGet("services/{serviceId}/organisations/{organisationId}/users/{userId}", GetUserServiceAccessDetails);
1818
}
1919
}

0 commit comments

Comments
 (0)