Skip to content

Comments

Task1 - create first version of CRUD#1

Open
lezhdz98 wants to merge 4 commits intomainfrom
task1
Open

Task1 - create first version of CRUD#1
lezhdz98 wants to merge 4 commits intomainfrom
task1

Conversation

@lezhdz98
Copy link
Owner

@lezhdz98 lezhdz98 commented Sep 4, 2024

No description provided.

@lezhdz98 lezhdz98 requested a review from Joxebus September 4, 2024 01:06
@@ -0,0 +1,16 @@
spring:
datasource:
driver-class-name: org.h2.Driver
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this for a real database like MySQL or Postgres, you can use Docker to run the database.

Copy link
Collaborator

@Joxebus Joxebus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check your comments and fix

pom.xml Outdated
<developers>
<developer/>
</developers>
<scm>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove sections url, licenses, developers and scm sections for now

path: /h2

logging:
config: classpath:log-config.xml No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it for just done

}
public void setCreationDate(LocalDateTime creationDate) {
this.creationDate = creationDate;
this.creationDate = LocalDateTime.now();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta fecha debe ser asignada en la capa de negocio no en esta parte.

}

public List<Task> findAll() {
return taskRepository.findAll();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambia la excepción por una personalizada

task.setDueDate(newTask.getDueDate());
task = taskRepository.save(task);

//logger.debug("Task updated: {}", task);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar por excepción personalizada.

# config: classpath:log-config.xml


#logging:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comentes esta configuración, agrega el archivo de configuración para los loggers

…ce, new endpoints, pagination and avg time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants