using DigitalData.Core.Abstraction.Application.Repository; using DigitalData.UserManager.Domain.Entities; using MediatR; namespace EnvelopeGenerator.Application.Users.Commands; /// /// /// public record CreateUserCommand : IRequest { /// /// /// public string? Prename { get; init; } /// /// /// public string? Name { get; init; } /// /// /// public required string Username { get; init; } /// /// /// public string? Shortname { get; init; } /// /// /// public string? Email { get; init; } /// /// /// public string Language { get; init; } = "de-DE"; /// /// /// public string? Comment { get; init; } /// /// /// public bool Deleted { get; } = false; /// /// /// public string DateFormat { get; init; } = "dd.MM.yyyy"; /// /// /// public bool Active { get; } = true; /// /// /// public string GeneralViewer { get; init; } = "NONE"; /// /// /// public bool WanEnvironment { get; } = false; /// /// /// public int UserIdFkIntEcm { get; init; } = 0; } /// /// /// public class CreateUserCommandHandler : IRequestHandler { private readonly IRepository _repo; /// /// /// /// public CreateUserCommandHandler(IRepository repo) { _repo = repo; } /// /// /// /// /// /// public async Task Handle(CreateUserCommand request, CancellationToken cancel = default) { var user = await _repo.CreateAsync(request, cancel); return user.Id; } }