#27 get last receipt, get minimalUser, get my user

This commit is contained in:
Dominic Villemure
2024-05-12 16:40:24 -04:00
parent 3f20563850
commit 5161e3a91a
17 changed files with 216 additions and 24 deletions

View File

@@ -7,6 +7,7 @@ public class GetMyUser : EndpointGroupBase
public override void Map(WebApplication app)
{
app.MapGroup(this)
.RequireAuthorization()
.MapGet(GetCurrentUser);
}

View File

@@ -1,4 +1,5 @@
using Hutopy.Application.Stripe.Commands;
using Hutopy.Application.Stripe.Queries;
namespace Hutopy.Web.Endpoints;
@@ -8,6 +9,7 @@ public class Stripe : EndpointGroupBase
{
app.MapGroup(this)
.MapPost(ConfirmTransaction, "/confirmTransaction")
.MapGet(GetMyLastReceipt, "/getMyLastReceipt")
.MapPost(CreateSessionCheckout);
}
@@ -20,4 +22,9 @@ public class Stripe : EndpointGroupBase
{
return await sender.Send(command);
}
private static async Task<MyLastReceiptDto> GetMyLastReceipt(ISender sender, [AsParameters] GetMyLastReceiptQuery query)
{
return await sender.Send(query);
}
}

View File

@@ -1,4 +1,5 @@
using Hutopy.Application.Users.Commands;
using Hutopy.Application.Users.Queries.GetMinimalUser;
using Hutopy.Domain.Interfaces;
using Hutopy.Infrastructure.Identity;
@@ -10,6 +11,7 @@ public class Users : EndpointGroupBase
{
app.MapGroup(this)
.MapPost(CreateUser)
.MapGet(GetMinimalUser)
.MapIdentityApi<ApplicationUser>();
}
@@ -18,4 +20,9 @@ public class Users : EndpointGroupBase
await userService.CreateUserAsync(command.EmailAddress, command.UserName, command.FirstName, command.LastName, command.Password);
return await sender.Send(command);
}
private static async Task<MinimalUserDto> GetMinimalUser(ISender sender, [AsParameters] GetMinimalUserQuery query)
{
return await sender.Send(query);
}
}