diff --git a/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommand.cs b/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommand.cs index 56c696f..ab0225c 100644 --- a/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommand.cs +++ b/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommand.cs @@ -5,7 +5,5 @@ namespace AipsCore.Application.Models.User.Command.CreateUser; public record CreateUserCommand( string Username, - string Email, - DateTime CreatedAt, - DateTime DeletedAt) + string Email) : ICommand; \ No newline at end of file diff --git a/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommandHandler.cs b/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommandHandler.cs index b52dcb4..fee9da3 100644 --- a/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommandHandler.cs +++ b/dotnet/AipsCore/Application/Models/User/Command/CreateUser/CreateUserCommandHandler.cs @@ -18,7 +18,7 @@ public class CreateUserCommandHandler : ICommandHandler Handle(CreateUserCommand command, CancellationToken cancellationToken = default) { - var user = Domain.Models.User.User.Create(command.Email, command.Username, command.CreatedAt, command.DeletedAt); + var user = Domain.Models.User.User.Create(command.Email, command.Username); await _userRepository.SaveAsync(user, cancellationToken); await _unitOfWork.SaveChangesAsync(cancellationToken); diff --git a/dotnet/AipsCore/Domain/Models/User/User.cs b/dotnet/AipsCore/Domain/Models/User/User.cs index 5b113cd..b16c2be 100644 --- a/dotnet/AipsCore/Domain/Models/User/User.cs +++ b/dotnet/AipsCore/Domain/Models/User/User.cs @@ -31,12 +31,12 @@ public class User : DomainModel return new User(userIdVo, emailVo, usernameVo, createdAtVo, deletedAtVo); } - public static User Create(string email, string username, DateTime createdAt, DateTime? deletedAt) + public static User Create(string email, string username) { var usernameVo = new Username(username); var emailVo = new Email(email); - var createdAtVo = new UserCreatedAt(createdAt); - var deletedAtVo = new UserDeletedAt(deletedAt); + var createdAtVo = new UserCreatedAt(DateTime.UtcNow); + var deletedAtVo = new UserDeletedAt(null); return new User(UserId.Any(), emailVo, usernameVo, createdAtVo, deletedAtVo); }