Conversation
src/main/resources/application.yml
Outdated
| @@ -0,0 +1,16 @@ | |||
| spring: | |||
| datasource: | |||
| driver-class-name: org.h2.Driver | |||
There was a problem hiding this comment.
Change this for a real database like MySQL or Postgres, you can use Docker to run the database.
Joxebus
left a comment
There was a problem hiding this comment.
Check your comments and fix
pom.xml
Outdated
| <developers> | ||
| <developer/> | ||
| </developers> | ||
| <scm> |
There was a problem hiding this comment.
Remove sections url, licenses, developers and scm sections for now
src/main/resources/application.yml
Outdated
| path: /h2 | ||
|
|
||
| logging: | ||
| config: classpath:log-config.xml No newline at end of file |
There was a problem hiding this comment.
There is no file called log-config.xml on src/main/resources folder, please add the configuration file or remove the entry
| //@Column(length = 120) | ||
| private String name; | ||
|
|
||
| private boolean checkDone; |
| } | ||
| public void setCreationDate(LocalDateTime creationDate) { | ||
| this.creationDate = creationDate; | ||
| this.creationDate = LocalDateTime.now(); |
There was a problem hiding this comment.
Esta fecha debe ser asignada en la capa de negocio no en esta parte.
| } | ||
|
|
||
| public List<Task> findAll() { | ||
| return taskRepository.findAll(); |
There was a problem hiding this comment.
Ahora que ya puedes listar, es necesario agregar un límite para paginar.
| } | ||
| Task task; | ||
| task = taskRepository.findById(newTask.getId()) | ||
| .orElseThrow(() -> new IllegalArgumentException("The task can't be updated.")); |
There was a problem hiding this comment.
Cambia la excepción por una personalizada
| task.setDueDate(newTask.getDueDate()); | ||
| task = taskRepository.save(task); | ||
|
|
||
| //logger.debug("Task updated: {}", task); |
There was a problem hiding this comment.
Lines comentadas nunca se deben dejar en el código, trata de evitarlas lo más posible
| task.setCheckDone(newTask.getCheckDone()); | ||
| task.setPriority(newTask.getPriority()); | ||
| task.setCreationDate(newTask.getCreationDate()); | ||
| //task.setCreationDate(newTask.getCreationDate()); |
There was a problem hiding this comment.
En lugar de comentar esta línea busca en que momento se debe agregar esta fecha
|
|
||
| public static void validate(Task task) { | ||
| if(task == null){ | ||
| throw new IllegalArgumentException("A null task is not valid."); |
There was a problem hiding this comment.
Cambiar por excepción personalizada
|
|
||
| private static void validateName(String name) { | ||
| if(name == null || name.isEmpty() || name.length()>120) { | ||
| throw new IllegalArgumentException("The task name is not valid."); |
There was a problem hiding this comment.
Cambiar por excepción personalizada.
src/main/resources/application.yml
Outdated
| # config: classpath:log-config.xml | ||
|
|
||
|
|
||
| #logging: |
There was a problem hiding this comment.
No comentes esta configuración, agrega el archivo de configuración para los loggers
…ce, new endpoints, pagination and avg time
No description provided.