using PostFundManagement.Application.Communications.Events; using PostFundManagement.Application.Extensions; using PostFundManagement.Domain.Abstractions; using PostFundManagement.Domain.Api; using PostFundManagement.Domain.Extensions; namespace PostFundManagement.Api.Endpoints.Communications; [ApiVersionTarget(1)] public class SyncIdentityUserEndpoint : IEndpoint { public void Map(IEndpointRouteBuilder builder) { builder.MapPost("api/integration/sync", async (IJobOrchestrator jobOrchestrator, CancellationToken cancellationToken = default) => { var syncEvent = new SyncUserEvent(); await jobOrchestrator.SendAsync(syncEvent, cancellationToken); return Results.Ok(); }) .WithDescription("Trigger integration and data synchronization in the background") .WithName(typeof(SyncIdentityUserEndpoint).ToEndpointName()) .MapToApiVersion(new ApiVersion(1)) .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status401Unauthorized) .WithTags(EndpointTags.Communications); } }