Commit 510e4e47 authored by hasan khaddour's avatar hasan khaddour

Fix CQRS For Projects Types

parent 7e7abea2
......@@ -8,6 +8,8 @@ using PSManagement.Application.Projects.Common;
using PSManagement.Application.Projects.UseCases.Commands.CompleteProgressProject;
using PSManagement.Application.ProjectsTypes.UseCases.Commands.CreateNewType;
using PSManagement.Application.Tracks.Common;
using PSManagement.Application.ProjectsTypes.Common;
using PSManagement.Application.Tracks.UseCaes.Commands.AddEmployeeTrack;
using PSManagement.Application.Tracks.UseCaes.Commands.AddStepTrack;
using PSManagement.Application.Tracks.UseCaes.Commands.CreateTrack;
......@@ -25,6 +27,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PSManagement.Domain.ProjectsTypes.Entites;
namespace PSManagement.Application.Mappers
{
......@@ -34,7 +37,7 @@ namespace PSManagement.Application.Mappers
{
CreateMap<CustomerDTO, Customer>().ReverseMap();
CreateMap<ContactInfoDTO, ContactInfo>().ReverseMap();
CreateMap<ProjectType, ProjectTypeDTO>().ReverseMap();
CreateMap<Step, StepDTO>()
;
......@@ -74,6 +77,7 @@ namespace PSManagement.Application.Mappers
CreateMap<Project, ProjectDTO>().ReverseMap();
CreateMap<Project, ProjectDetailsDTO>().ReverseMap();
CreateMap<ProjectType, ProjectTypeDTO>().ReverseMap();
CreateMap<Project, ProjectInfo>()
.ConvertUsing(project => project.ProjectInfo);
......
......@@ -24,4 +24,8 @@
<ProjectReference Include="..\PSManagement.SharedKernel\PSManagement.SharedKernel.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Projects\UseCases\Queries\GetParticipationChangeHistory\" />
</ItemGroup>
</Project>
......@@ -37,7 +37,7 @@ namespace PSManagement.Application.Projects.UseCases.Commands.CreateProject
var type = await _projectTypesRepository.GetByIdAsync(request.ProjectTypeId);
if (type is null) {
return Result.Invalid(PrjectTypesErrors.InvalidEntryError);
return Result.Invalid(ProjectTypesErrors.InvalidEntryError);
}
Project project = _projectBuilder
......
......@@ -6,6 +6,7 @@
public string TypeName { get; set; }
public string Description { get; set; }
public int ExpectedEffort { get; set; }
public int ExpectedNumberOfWorker { get; set; }
}
}
\ No newline at end of file
using Ardalis.Result;
using AutoMapper;
using PSManagement.Domain.Projects.DomainErrors;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.ProjectsTypes.Entites;
using PSManagement.SharedKernel.CQRS.Command;
using System.Linq;
using System.Threading;
......@@ -29,7 +29,7 @@ namespace PSManagement.Application.ProjectsTypes.UseCases.Commands.CreateNewType
if (result.Count() !=0 )
{
return Result.Invalid(PrjectTypesErrors.InvalidName);
return Result.Invalid(ProjectTypesErrors.InvalidName);
}
var projectType = await _projectTypesRepository.AddAsync(_mapper.Map<ProjectType>(request));
......
......@@ -2,8 +2,8 @@
using AutoMapper;
using PSManagement.Domain.Projects;
using PSManagement.Domain.Projects.DomainErrors;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.ProjectsTypes.Entites;
using PSManagement.SharedKernel.CQRS.Command;
using PSManagement.SharedKernel.Specification;
using System.Threading;
......@@ -31,11 +31,11 @@ namespace PSManagement.Application.ProjectsTypes.UseCases.Commands.CreateNewType
if (result is null)
{
return Result.Invalid(PrjectTypesErrors.InvalidEntryError);
return Result.Invalid(ProjectTypesErrors.InvalidEntryError);
}
if (result.Projects is not null )
{
return Result.Invalid(PrjectTypesErrors.InvalidEntryError);
return Result.Invalid(ProjectTypesErrors.InvalidEntryError);
}
await _projectTypesRepository.DeleteAsync(result);
......
using Ardalis.Result;
using AutoMapper;
using PSManagement.Domain.Projects.DomainErrors;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.ProjectsTypes.Entites;
using PSManagement.SharedKernel.CQRS.Command;
using System.Linq;
using System.Threading;
......
using Ardalis.Result;
using AutoMapper;
using PSManagement.Application.ProjectsTypes.Common;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.ProjectsTypes.Entites;
using PSManagement.SharedKernel.CQRS.Query;
using PSManagement.SharedKernel.Specification;
using System.Collections.Generic;
......
......@@ -25,12 +25,12 @@ namespace PSManagement.Application.ProjectsTypes.UseCases.Queries.GetTypeById
public async Task<Result<ProjectTypeDTO>> Handle(GetTypeByIdQuery request, CancellationToken cancellationToken)
{
var result = await _projectTypesRepository.ListAsync();
var result = await _projectTypesRepository.GetByIdAsync(request.TypeId);
if (result is null)
{
return Result.Invalid(PrjectTypesErrors.InvalidEntryError);
return Result.Invalid(ProjectTypesErrors.InvalidEntryError);
}
return Result.Success(_mapper.Map<ProjectTypeDTO>(result)); ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment