23 lines
896 B
C#
23 lines
896 B
C#
using Indotalent.ConfigBackEnd.Extensions;
|
|
using Indotalent.Features.Purchase.PurchaseReport.Cqrs;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
|
|
namespace Indotalent.Features.Purchase.PurchaseReport;
|
|
|
|
public static class PurchaseReportEndpoint
|
|
{
|
|
public static void MapPurchaseReportEndpoints(this IEndpointRouteBuilder app)
|
|
{
|
|
var group = app.MapGroup("/purchase-report").WithTags("PurchaseReports")
|
|
.RequireAuthorization(policy => policy.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
|
|
.RequireAuthenticatedUser());
|
|
|
|
group.MapGet("/", async (IMediator mediator) =>
|
|
{
|
|
var result = await mediator.Send(new GetPurchaseReportListQuery());
|
|
return result.ToApiResponse("Purchase report list retrieved successfully");
|
|
})
|
|
.WithName("GetPurchaseReportList");
|
|
}
|
|
} |