-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prueba Técnica Marcos Sánchez Hernández #2
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Gestión correcta del repositorio
- La data transformation lo realiza de forma correcta con cosas que podrían mejorarse
- La conexión con el web service no gestiona las excepciones o si se llega a caer el servicio.
- Sería bueno que esten comentadas todas las funciones métodos y atributos, de esta forma puede haber mejor seguimiento de código.
|
||
namespace PruebaTecnica.Repository | ||
{ | ||
public class BalanceResponsiblePartyRepository : Repository<BalanceResponsibleParty>, IBalanceResponsiblePartyRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comentarios sobre lo que hace la clase
_webApiExterna = webApiExterna; | ||
_balanceResponsiblePartyServiceRepository = balanceResponsiblePartyServiceRepository; | ||
} | ||
|
||
public ServiceResult<BalanceReponsiblePartiesModels> GetData(int id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Añadir el patrón de comentarios sobre obtener la información de los datos o colocar una breve descripción de lo que hace el método,
Por lo general se escribe @id: y una breve descripción.
} | ||
|
||
public ServiceResult<BalanceReponsiblePartiesModels> GetData(int id) | ||
{ | ||
var result = new ServiceResult<BalanceReponsiblePartiesModels>(); | ||
|
||
var data = _context.BalanceResponsibles.FirstOrDefault(x => x.Id == id); | ||
var data = _balanceResponsiblePartyServiceRepository.Get(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como recomendación añadir el tipo de dato que devuelve la respuesta
{ | ||
public class BalanceReponsiblePartiesDTO | ||
{ | ||
[JsonProperty("BrpCode")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se valorará mucho los comentarios de cada una de las propiedades para poder entender mejor los datos que se están transformando
{ | ||
[ApiController] | ||
[Route("MarketPartiesController")] | ||
public class MarketPartiesController : ControllerBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Añadir breves comentarios de lo que hace el controlador
{ | ||
[Key] | ||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Esta anotación hace que el ID sea autoincremental | ||
public int Id { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Siempre es positivo añadir la una breve descripción de las propiedades de lo que se va a obtener de esta forma mejorará la lectura del código
{ | ||
var result = new ServiceResult<BalanceReponsiblePartiesModels>(); | ||
var datosApi = _webApiExterna.TraerDatosApi(code, country, name); | ||
if (datosApi.CodigoResultado == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validación de http error, o si lanza alguna excepción como error 500 o 404
|
||
result.Data = new BalanceReponsiblePartiesModels() | ||
{ | ||
CodigoResultado = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Por lo general cuando se gestiona los errores se maneja las excepciones
Creación de una api de swagger para traer los datos según el filtro de que se introduzca simulando al de la Api dada a la cual llama.
Se implementa una arquitectura DDD para controlador y servicios necesarios.
Se implementa una arquitectura repository para guardar y traer los objetos desde la BBDD, se implementan tambien mapeos de DTO a entidad y viceversa para la gestión de los datos.
Se hace uso de Linq.
Implementación de errores según se encuentren datos o no se pueda realizar la petición