#27 saveChanges

This commit is contained in:
Dominic Villemure
2024-04-22 16:34:17 -04:00
parent b63d53f109
commit bd6028c524
2 changed files with 6 additions and 5 deletions

View File

@@ -27,6 +27,8 @@ public class CreateSessionCheckoutCommandHandler(
await dbContext.UserTransactions.AddAsync(userTransaction, cancellationToken); await dbContext.UserTransactions.AddAsync(userTransaction, cancellationToken);
await dbContext.SaveChangesAsync(cancellationToken);
return stripeSecret; return stripeSecret;
} }
} }

View File

@@ -1,13 +1,11 @@
using System.Security.Claims; using Hutopy.Domain.Interfaces;
using Hutopy.Domain.Interfaces;
using Hutopy.Domain.Models; using Hutopy.Domain.Models;
using Hutopy.Infrastructure.Identity; using Hutopy.Infrastructure.Identity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
namespace Hutopy.Infrastructure.Services; namespace Hutopy.Infrastructure.Services;
public class UserService(UserManager<ApplicationUser> userManager, IHttpContextAccessor httpContextAccessor) : IUserService public class UserService(UserManager<ApplicationUser> userManager) : IUserService
{ {
public async Task CreateUserAsync(string email, string userName, string firstName, string lastName, string password) public async Task CreateUserAsync(string email, string userName, string firstName, string lastName, string password)
{ {
@@ -48,7 +46,8 @@ public class UserService(UserManager<ApplicationUser> userManager, IHttpContextA
public async Task<UserModel?> GetCurrentUserAsync() public async Task<UserModel?> GetCurrentUserAsync()
{ {
var userId = httpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier); // todo: Get the id of the user doing the request.
var userId = "";
if (string.IsNullOrEmpty(userId)) if (string.IsNullOrEmpty(userId))
{ {
return null; return null;