create role for new users

This commit is contained in:
john 2025-05-18 23:03:25 +02:00
parent 34aee3a168
commit 22e838849f
2 changed files with 15 additions and 5 deletions

View file

@ -1,6 +1,7 @@
using System.Text;
using System.Text.Unicode;
using Femto.Common.Domain;
using Femto.Modules.Auth.Contracts;
using Femto.Modules.Auth.Models.Events;
using Geralt;
@ -25,6 +26,8 @@ internal class UserIdentity : Entity
this.Id = Guid.CreateVersion7();
this.Username = username;
this.Roles = [new UserRole(Role.User)];
this.AddDomainEvent(new UserWasCreatedEvent(this));
}

View file

@ -7,4 +7,11 @@ internal class UserRole
public Guid UserId { get; set; }
public Role Role { get; set; }
private UserRole() {}
public UserRole( Role role){
Role = role;
}
}