fix: comparaison between two projects instead of their IDs
This commit is contained in:
parent
aaa6e46d0c
commit
9e1f568ea4
@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class UtilsService {
|
||||
|
||||
@ -45,7 +47,9 @@ public class UtilsService {
|
||||
User user = this.userService.getUserByEmail(mail);
|
||||
Entrepreneur entrepreneur = this.entrepreneurService.getEntrepreneurById(user.getIdUser());
|
||||
Project project = this.projectService.getProjectById(projectId);
|
||||
return entrepreneur.getProjectParticipation().equals(project);
|
||||
// We compare the ID instead of the project themselves
|
||||
return Objects.equals(
|
||||
entrepreneur.getProjectParticipation().getIdProject(), project.getIdProject());
|
||||
}
|
||||
|
||||
// TODO: test
|
||||
@ -56,6 +60,7 @@ public class UtilsService {
|
||||
return true;
|
||||
} catch (ResponseStatusException e) {
|
||||
logger.info(e);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -87,13 +87,17 @@ public class EntrepreneurApiServiceTest {
|
||||
|
||||
@Test
|
||||
void editValidSectionCell() {
|
||||
System.out.println("START\n\n\n");
|
||||
entrepreneurApiService.editSectionCell(
|
||||
IterableToList(sectionCells).getFirst().getIdSectionCell(),
|
||||
"modified content",
|
||||
"entrepreneur@mail.fr");
|
||||
// We get the data from the database again.
|
||||
sectionCells = sectionCellService.getSectionCellsByProject(project, 2L);
|
||||
assertEquals(
|
||||
"modified content",
|
||||
IterableToList(sectionCells).getFirst().getContentSectionCell());
|
||||
System.out.println("END\n\n\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user