@Override public TodoDTO update(TodoDTO todo) { LOGGER.info("Updating todo entry with information: {}", todo); Todo updated = findTodoById(todo.getId()); updated.update(todo.getTitle(), todo.getDescription()); updated = repository.save(updated); LOGGER.info("Updated todo entry with information: {}", updated); return convertToDTO(updated); }
@Override public TodoDTO create(TodoDTO todo) { LOGGER.info("Creating a new todo entry with information: {}", todo); Todo persisted = Todo.getBuilder().title(todo.getTitle()).description(todo.getDescription()).build(); persisted = repository.save(persisted); LOGGER.info("Created a new todo entry with information: {}", persisted); return convertToDTO(persisted); }