30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
using Indotalent.ConfigBackEnd.Extensions;
|
|
using Indotalent.Features.Inventory.TransactionReport.Cqrs;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
|
|
namespace Indotalent.Features.Inventory.TransactionReport;
|
|
|
|
public static class TransactionReportEndpoint
|
|
{
|
|
public static void MapTransactionReportEndpoints(this IEndpointRouteBuilder app)
|
|
{
|
|
var group = app.MapGroup("/transaction-report").WithTags("TransactionReports")
|
|
.RequireAuthorization(policy => policy.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
|
|
.RequireAuthenticatedUser());
|
|
|
|
group.MapGet("/", async (IMediator mediator) =>
|
|
{
|
|
var result = await mediator.Send(new GetInventoryTransactionReportListQuery());
|
|
return result.ToApiResponse("Transaction report list retrieved successfully");
|
|
})
|
|
.WithName("GetInventoryTransactionReportList");
|
|
|
|
group.MapGet("/lookup", async (IMediator mediator) =>
|
|
{
|
|
var result = await mediator.Send(new GetInventoryTransactionReportLookupQuery());
|
|
return result.ToApiResponse("Lookup data retrieved successfully");
|
|
})
|
|
.WithName("GetInventoryTransactionReportLookup");
|
|
}
|
|
} |