| 123456789101112131415161718192021222324252627282930313233 |
- using MediatR;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Developers.Apps;
- internal sealed class Update : IEndpoint
- {
- public sealed record Request(string Name, string? Description, string? HomepageUrl);
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPut("api/developers/apps/{appID:int}", async (
- int appID,
- Request body,
- HttpContext httpContext,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = httpContext.User.GetRequiredMemberID();
- var command = new Application.Features.Api.Developers.Apps.UpdateApp.Command(
- memberID, appID, body.Name, body.Description, body.HomepageUrl
- );
- var result = await sender.Send(command, ct);
- return result.Match(
- () => Results.NoContent(),
- CustomResults.Problem
- );
- })
- .WithTags("Developers")
- .RequireAuthorization();
- }
- }
|