#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);
}
}

View File

@@ -23,7 +23,12 @@
}
}
}
}
},
"security": [
{
"JWT": []
}
]
}
},
"/api/JoinUs": {
@@ -131,6 +136,48 @@
}
}
},
"/api/Stripe/getMyLastReceipt": {
"get": {
"tags": [
"Stripe"
],
"operationId": "GetMyLastReceipt",
"parameters": [
{
"name": "Email",
"in": "query",
"required": true,
"schema": {
"type": "string",
"nullable": true
},
"x-position": 1
},
{
"name": "CreatorId",
"in": "query",
"required": true,
"schema": {
"type": "string",
"nullable": true
},
"x-position": 2
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MyLastReceiptDto"
}
}
}
}
}
}
},
"/api/Stripe": {
"post": {
"tags": [
@@ -194,6 +241,36 @@
}
}
}
},
"get": {
"tags": [
"Users"
],
"operationId": "GetMinimalUser",
"parameters": [
{
"name": "UserId",
"in": "query",
"required": true,
"schema": {
"type": "string",
"nullable": true
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MinimalUserDto"
}
}
}
}
}
}
},
"/api/Users/register": {
@@ -625,6 +702,9 @@
"lastName": {
"type": "string"
},
"userName": {
"type": "string"
},
"userTransactions": {
"type": "array",
"items": {
@@ -814,6 +894,15 @@
}
}
},
"MyLastReceiptDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"receiptUrl": {
"type": "string"
}
}
},
"CreateSessionCheckoutCommand": {
"type": "object",
"additionalProperties": false,
@@ -854,6 +943,21 @@
}
}
},
"MinimalUserDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"userName": {
"type": "string"
}
}
},
"HttpValidationProblemDetails": {
"allOf": [
{