Skip to content

Commit

Permalink
Merge pull request #8 from felipementel/feature/refact
Browse files Browse the repository at this point in the history
feat: corrigindo erros e melhorando a leitura
  • Loading branch information
felipementel authored Jun 19, 2024
2 parents 59f1455 + 837300c commit 32c5eb7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
21 changes: 12 additions & 9 deletions infrastructure/dockerfile/docker-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
version: '3.8'

services:
mongodb:
image: mongo:7.0.7
container_name: mongodb-curso
mongodb-curso-sn:
image: mongo:7.0.8
container_name: mongodb-cursocn
restart: always
ports:
- 27017:27017
Expand All @@ -18,24 +18,27 @@ services:
networks:
- rede-net

mongo-express:
mongo-express-sn:
image: mongo-express:1.0.2-20
container_name: mongo-express-curso
container_name: mongoexpress-cursocn
restart: always
depends_on:
- mongodb
- mongodb-curso-sn
ports:
- 8081:8081
- 8001:8081
environment:
ME_CONFIG_MONGODB_ENABLE_ADMIN: 'true'
ME_CONFIG_MONGODB_SERVER: mongodb-cursocn
ME_CONFIG_BASICAUTH_USERNAME: mongoexpress-user
ME_CONFIG_BASICAUTH_PASSWORD: mongoexpress-pass
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_OPTIONS_EDITORTHEME: 'ambiance'
ME_CONFIG_OPTIONS_EDITORTHEME: 'dracula'
ME_CONFIG_SITE_BASEURL: '/'
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: Abc12345678
ME_CONFIG_MONGODB_URL: mongodb://root:Abc12345678@mongodb-curso:27017/
ME_CONFIG_MONGODB_URL: mongodb://root:Abc12345678@mongodb-cursocn:27017/
networks:
- rede-net

networks:
rede-net:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public EmployeeProfile()
ctor.Ativo,
ctor.Salario,
employeeRole: res.Mapper.Map<Domain.Aggregates.EmployeeRole.Entities.EmployeeRole>(ctor.Cargo));
})
.ForAllMembers(i => i.Ignore());
});


CreateMap<Domain.Aggregates.Employee.Entities.Employee, Dtos.Employee.EmployeeDto>()
Expand All @@ -28,8 +27,7 @@ public EmployeeProfile()
.ForMember(dest => dest.Ativo, opt => opt.MapFrom(src => src.Active))
.ForMember(dest => dest.Salario, opt => opt.MapFrom(src => src.Salary))
.ForMember(dest => dest.Cargo, opt => opt.MapFrom(src => src.EmployeeRole))
.ForMember(dest => dest.Errors, opt => opt.MapFrom(src => src.Erros))
.ForAllMembers(i => i.Ignore());
.ForMember(dest => dest.Errors, opt => opt.MapFrom(src => src.Erros));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ public EmployeeRoleProfile()
{
return new Domain.Aggregates.EmployeeRole.Entities.EmployeeRole(
ctor.Cargo);
})
.ForAllMembers(i => i.Ignore());

// .ForCtorParam("roleName", opt => opt.MapFrom(src => src.Cargo))
// .ForAllOtherMembers(i => i.Ignore());
});

CreateMap<Domain.Aggregates.EmployeeRole.Entities.EmployeeRole, Dtos.EmployeeRole.EmployeeRoleDto>()
.ForMember(dest => dest.Identificador, opt => opt.MapFrom(src => src.Id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task DeleteEmployeeAsync(string id)

if (item is not null)
{
var newItem = item with
var newItem = item with
{
FirstName = employee.FirstName,
Surname = employee.Surname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using Avanade.SubTCSE.Projeto.Domain.Aggregates.EmployeeRole.Interfaces.Repositories;
using Avanade.SubTCSE.Projeto.Domain.Aggregates.EmployeeRole.Interfaces.Services;
using FluentValidation;
using SharpCompress.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

Expand Down Expand Up @@ -63,7 +60,8 @@ public async Task DeleteEmployeeRoleAsync(string id)
if (!validated.IsValid)
{
employeeRole.Erros = validated.Errors.Select(x => x.ErrorMessage).ToList();
return employeeRole; }
return employeeRole;
}

var item = await _employeeRoleRepository.FindByIdAsync(id);

Expand All @@ -72,7 +70,6 @@ public async Task DeleteEmployeeRoleAsync(string id)
var newItem = item with
{
RoleName = employeeRole.RoleName,

Erros = employeeRole.Erros
};

Expand All @@ -82,7 +79,7 @@ public async Task DeleteEmployeeRoleAsync(string id)
}
else
{
//TODO: Return Validation Result
employeeRole.Erros = new List<string> { "Employee role not found." };
return employeeRole;
}
}
Expand Down

0 comments on commit 32c5eb7

Please sign in to comment.