| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using MediatR;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Developers.Profile;
- internal sealed class Upsert : IEndpoint
- {
- public sealed record Request(
- string CompanyName,
- string BusinessNumber,
- string CeoName,
- string ContactName,
- string ContactPhone
- );
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPut("api/developers/profile", async (
- Request body,
- HttpContext httpContext,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = httpContext.User.GetRequiredMemberID();
- var command = new Application.Features.Api.Developers.Profile.UpsertProfile.Command(
- memberID,
- body.CompanyName,
- body.BusinessNumber,
- body.CeoName,
- body.ContactName,
- body.ContactPhone
- );
- var result = await sender.Send(command, ct);
- return result.Match(
- data => Results.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("Developers")
- .RequireAuthorization();
- }
- }
|