Skip to content

Commit 3235572

Browse files
feature(#20): this commit restores the return of the client model after creation, instead of a response with no body
1 parent dc6096c commit 3235572

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Applications/Backend/Source/HttpsRichardy.Federation.Application/Handlers/Client/ClientCreationHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace HttpsRichardy.Federation.Application.Handlers.Client;
22

33
public sealed class ClientCreationHandler(IClientCredentialsGenerator credentialsGenerator, IRealmProvider realmProvider, IClientCollection clientCollection) :
4-
IDispatchHandler<ClientCreationScheme, Result>
4+
IDispatchHandler<ClientCreationScheme, Result<ClientScheme>>
55
{
6-
public async Task<Result> HandleAsync(ClientCreationScheme parameters, CancellationToken cancellation = default)
6+
public async Task<Result<ClientScheme>> HandleAsync(ClientCreationScheme parameters, CancellationToken cancellation = default)
77
{
88
var filters = ClientFilters.WithSpecifications()
99
.WithName(parameters.Name)
@@ -14,7 +14,7 @@ public async Task<Result> HandleAsync(ClientCreationScheme parameters, Cancellat
1414

1515
if (existingClient is not null)
1616
{
17-
return Result.Failure(ClientErrors.ClientAlreadyExists);
17+
return Result<ClientScheme>.Failure(ClientErrors.ClientAlreadyExists);
1818
}
1919

2020
var realm = realmProvider.GetCurrentRealm();
@@ -24,6 +24,6 @@ public async Task<Result> HandleAsync(ClientCreationScheme parameters, Cancellat
2424

2525
await clientCollection.InsertAsync(client, cancellation: cancellation);
2626

27-
return Result.Success();
27+
return Result<ClientScheme>.Success(client.AsResponse());
2828
}
2929
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace HttpsRichardy.Federation.Application.Payloads.Client;
22

3-
public sealed record ClientCreationScheme : IDispatchable<Result>
3+
public sealed record ClientCreationScheme : IDispatchable<Result<ClientScheme>>
44
{
55
public string Name { get; init; } = default!;
66

77
public IEnumerable<Grant> Flows { get; init; } = [];
88
public IEnumerable<String> RedirectUris { get; init; } = [];
9-
}
9+
}

0 commit comments

Comments
 (0)