initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
@@ -0,0 +1,35 @@
using Indotalent.ConfigBackEnd.Extensions;
using Indotalent.Features.Profile.PersonalInformation.Cqrs;
using MediatR;
using Microsoft.AspNetCore.Authentication.JwtBearer;
namespace Indotalent.Features.Profile.PersonalInformation;
public static class PersonalInformationEndpoint
{
public static void MapPersonalInformationEndpoints(this IEndpointRouteBuilder app)
{
var group = app.MapGroup("/personal-information").WithTags("Personal Information")
.RequireAuthorization(policy => policy.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
.RequireAuthenticatedUser());
group.MapGet("/{id}", async (string id, IMediator mediator) =>
{
var result = await mediator.Send(new GetProfileByIdQuery(id));
return result.ToApiResponse(result is not null
? "Personal information retrieved successfully"
: $"User with ID {id} not found");
})
.WithName("GetPersonalInformationById");
group.MapPost("/update", async (UpdateProfileRequest request, IMediator mediator) =>
{
var result = await mediator.Send(new UpdateProfileCommand(request));
if (!result.Success)
return ((object?)null).ToApiResponse(result.Message ?? "Update failed.", StatusCodes.Status400BadRequest);
return result.ToApiResponse("Personal information has been updated successfully");
})
.WithName("UpdatePersonalInformation");
}
}