Merge branch 'master' into feature/oauth

This commit is contained in:
Kamigen
2024-04-28 19:19:28 -04:00
23 changed files with 1185 additions and 53 deletions

View File

@@ -0,0 +1,17 @@
using Hutopy.Application.Users.Queries;
namespace Hutopy.Web.Endpoints;
public class GetMyUser : EndpointGroupBase
{
public override void Map(WebApplication app)
{
app.MapGroup(this)
.MapGet(GetCurrentUser);
}
private static async Task<UserDto> GetCurrentUser(ISender sender, [AsParameters] GetCurrentUserQuery query)
{
return await sender.Send(query);
}
}

View File

@@ -7,6 +7,7 @@ public class Stripe : EndpointGroupBase
public override void Map(WebApplication app)
{
app.MapGroup(this)
.MapPost(ConfirmTransaction, "/confirmTransaction")
.MapPost(CreateSessionCheckout);
}
@@ -14,4 +15,9 @@ public class Stripe : EndpointGroupBase
{
return sender.Send(command);
}
private static Task<string> ConfirmTransaction(ISender sender, ConfirmStripeTransactionCommand command)
{
return sender.Send(command);
}
}

View File

@@ -13,7 +13,7 @@ public class Users : EndpointGroupBase
.MapIdentityApi<ApplicationUser>();
}
public async Task<Guid> CreateUser(ISender sender, CreateUserCommand command, IUserService userService)
private static async Task<Guid> CreateUser(ISender sender, CreateUserCommand command, IUserService userService)
{
await userService.CreateUserAsync(command.EmailAddress, command.UserName, command.FirstName, command.LastName, command.Password);
return await sender.Send(command);

View File

@@ -6,32 +6,19 @@
"version": "1.0.0"
},
"paths": {
"/api/Google": {
"post": {
"/api/GetMyUser": {
"get": {
"tags": [
"Google"
"GetMyUser"
],
"operationId": "CreateGoogleUser",
"requestBody": {
"x-name": "command",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateGoogleUserCommand"
}
}
},
"required": true,
"x-position": 1
},
"operationId": "GetCurrentUser",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "string",
"format": "guid"
"$ref": "#/components/schemas/UserDto"
}
}
}
@@ -112,6 +99,38 @@
}
}
},
"/api/Stripe/confirmTransaction": {
"post": {
"tags": [
"Stripe"
],
"operationId": "ConfirmTransaction",
"requestBody": {
"x-name": "command",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConfirmStripeTransactionCommand"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/api/Stripe": {
"post": {
"tags": [
@@ -592,11 +611,40 @@
},
"components": {
"schemas": {
"CreateGoogleUserCommand": {
"UserDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"accessToken": {
"id": {
"type": "string",
"format": "guid"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"userTransactions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserTransactionDto"
}
}
}
},
"UserTransactionDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"amount": {
"type": "number",
"format": "decimal"
},
"currency": {
"type": "string"
},
"tipMessage": {
"type": "string"
}
}
@@ -671,17 +719,35 @@
}
}
},
"CreateSessionCheckoutCommand": {
"ConfirmStripeTransactionCommand": {
"type": "object",
"x-abstract": true,
"additionalProperties": false,
"properties": {
"price": {
"userTransactionId": {
"type": "string",
"format": "guid"
},
"isConfirmed": {
"type": "boolean"
}
}
},
"CreateSessionCheckoutCommand": {
"type": "object",
"additionalProperties": false,
"properties": {
"creatorId": {
"type": "string"
},
"amount": {
"type": "integer",
"format": "int32"
},
"currency": {
"type": "string"
},
"tipMessage": {
"type": "string"
}
}
},