Fixed issues

This commit is contained in:
2024-08-29 13:18:35 +03:00
parent 4a6b8c902f
commit 8884bac7fd
9 changed files with 79 additions and 43 deletions

View File

@@ -2,15 +2,14 @@
namespace ApplicationLayer.Services.Applicants.Models;
/// Model of
/// <see cref="Applicant" />
/// Model of <see cref="Applicant" />
public class ApplicantModel
{
/// <inheritdoc cref="Applicant.Name" />
public Name Name { get; set; } = null!;
public NameModel Name { get; set; } = null!;
/// <inheritdoc cref="Applicant.Passport" />
public Passport Passport { get; set; } = null!;
public PassportModel Passport { get; set; } = null!;
/// <inheritdoc cref="Applicant.BirthDate" />
public DateTime BirthDate { get; set; }
@@ -34,16 +33,16 @@ public class ApplicantModel
public MaritalStatus MaritalStatus { get; set; }
/// <inheritdoc cref="Applicant.FatherName" />
public Name FatherName { get; set; } = null!;
public NameModel FatherName { get; set; } = null!;
/// <inheritdoc cref="Applicant.MotherName" />
public Name MotherName { get; set; } = null!;
public NameModel MotherName { get; set; } = null!;
/// <inheritdoc cref="Applicant.JobTitle" />
public string JobTitle { get; set; } = null!;
/// <inheritdoc cref="Applicant.PlaceOfWork" />
public PlaceOfWork PlaceOfWork { get; set; } = null!;
public PlaceOfWorkModel PlaceOfWork { get; set; } = null!;
/// <inheritdoc cref="Applicant.IsNonResident" />
public bool IsNonResident { get; set; }

View File

@@ -1,4 +1,5 @@
using ApplicationLayer.Services.Users.Requests;
using ApplicationLayer.Services.Users.Models;
using ApplicationLayer.Services.Users.Requests;
using Domains.Users;
namespace ApplicationLayer.Services.Users;
@@ -8,7 +9,7 @@ public interface IUsersService
{
/// Returns all user accounts with role of approving authority
/// <param name="cancellationToken">Cancellation token</param>
Task<List<User>> GetAuthoritiesAccountsAsync(CancellationToken cancellationToken);
Task<List<UserModel>> GetAuthoritiesAccountsAsync(CancellationToken cancellationToken);
/// Changes authentication data for an authority account
/// <param name="request"> Request object with identifier of user and new authentication data</param>

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using Domains;
namespace ApplicationLayer.Services.Users.Models
{
public class UserModel
{
/// Unique Identifier of user
[Required]
public Guid Id { get; private set; } = Guid.NewGuid();
[Required]
[MaxLength(ConfigurationConstraints.EmailLength)]
public string Email { get; set; } = null!;
}
}

View File

@@ -2,15 +2,20 @@
using ApplicationLayer.Services.AuthServices.Common;
using ApplicationLayer.Services.AuthServices.NeededServices;
using ApplicationLayer.Services.Users.Exceptions;
using ApplicationLayer.Services.Users.Models;
using ApplicationLayer.Services.Users.Requests;
using AutoMapper;
using Domains.Users;
namespace ApplicationLayer.Services.Users;
public class UsersService(IUsersRepository users, IUnitOfWork unitOfWork) : IUsersService
public class UsersService(IMapper mapper, IUsersRepository users, IUnitOfWork unitOfWork) : IUsersService
{
async Task<List<User>> IUsersService.GetAuthoritiesAccountsAsync(CancellationToken cancellationToken) =>
await users.GetAllOfRoleAsync(Role.ApprovingAuthority, cancellationToken);
async Task<List<UserModel>> IUsersService.GetAuthoritiesAccountsAsync(CancellationToken cancellationToken)
{
var userList = await users.GetAllOfRoleAsync(Role.ApprovingAuthority, cancellationToken);
return mapper.Map<List<UserModel>>(userList);
}
async Task IUsersService.ChangeAuthorityAuthDataAsync(ChangeUserAuthDataRequest request, CancellationToken cancellationToken)
{