permitindo cadastrar tarefa sem projeto
This commit is contained in:
parent
495984e1a4
commit
25770cf58f
3 changed files with 7 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import net.beetechgroup.beetask.frameworks.persistence.entities.ProjectEntity;
|
|||
public class ProjectEntityMapper {
|
||||
|
||||
public static ProjectEntity toEntity(Project project) {
|
||||
if (project == null) return null;
|
||||
ProjectEntity entity = new ProjectEntity();
|
||||
entity.setId(project.getId());
|
||||
entity.setName(project.getName());
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class CreateTaskMapper {
|
|||
task.getTitle(),
|
||||
task.getDescription(),
|
||||
task.getStatus(),
|
||||
task.getProject().getName(),
|
||||
task.getProject() != null ? task.getProject().getName() : null,
|
||||
task.getHistory().stream().map(CreateTaskMapper::toTaskHistoryItemOutput).toList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,11 @@ public class CreateTaskUseCase {
|
|||
task.setTitle(input.title());
|
||||
task.setDescription(input.description());
|
||||
task.setStatus(input.status());
|
||||
task.setProject(new Project());
|
||||
task.getProject().setId(input.projectId());
|
||||
if (input.projectId() != null) {
|
||||
Project project = new Project();
|
||||
project.setId(input.projectId());
|
||||
task.setProject(project);
|
||||
}
|
||||
return CreateTaskMapper.toCreateTaskOutput(taskRepository.saveTask(task));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue