using Indotalent.ConfigBackEnd.Extensions; using Indotalent.Features.Profile.Password.Cqrs; using MediatR; using Microsoft.AspNetCore.Authentication.JwtBearer; namespace Indotalent.Features.Profile.Password; public static class PasswordEndpoint { public static void MapPasswordEndpoints(this IEndpointRouteBuilder app) { var group = app.MapGroup("/profile-password").WithTags("Profile Password") .RequireAuthorization(policy => policy.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme) .RequireAuthenticatedUser()); group.MapPost("/update", async (UpdatePasswordRequest request, IMediator mediator) => { var result = await mediator.Send(new UpdatePasswordCommand(request)); if (!result.Success) return ((object?)null).ToApiResponse(result.Message ?? "Failed to update password", StatusCodes.Status400BadRequest); return result.ToApiResponse("Password has been updated successfully"); }) .WithName("UpdateProfilePassword"); } }