feat: renamex title to sectionId and added a new shared API call
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package enseirb.myinpulse.service.database;
|
||||
|
||||
import enseirb.myinpulse.model.Project;
|
||||
import enseirb.myinpulse.model.SectionCell;
|
||||
import enseirb.myinpulse.repository.SectionCellRepository;
|
||||
|
||||
@ -43,14 +44,14 @@ public class SectionCellService {
|
||||
}
|
||||
|
||||
public SectionCell updateSectionCell(
|
||||
Long id, String title, String contentSectionCell, LocalDateTime modificationDate) {
|
||||
Long id, Long sectionId, String contentSectionCell, LocalDateTime modificationDate) {
|
||||
Optional<SectionCell> sectionCell = this.sectionCellRepository.findById(id);
|
||||
if (sectionCell.isEmpty()) {
|
||||
throw new ResponseStatusException(
|
||||
HttpStatus.NOT_FOUND, "Cette cellule de section n'existe pas");
|
||||
}
|
||||
if (title != null) {
|
||||
sectionCell.get().setTitle(title);
|
||||
if (sectionId != null) {
|
||||
sectionCell.get().setSectionId(sectionId);
|
||||
}
|
||||
if (contentSectionCell != null) {
|
||||
sectionCell.get().setContentSectionCell(contentSectionCell);
|
||||
@ -60,4 +61,8 @@ public class SectionCellService {
|
||||
}
|
||||
return this.sectionCellRepository.save(sectionCell.get());
|
||||
}
|
||||
|
||||
public Iterable<SectionCell> getSectionCellsByProject(Project project, Long sectionId) {
|
||||
return this.sectionCellRepository.findByProjectSectionCellAndSectionId(project, sectionId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user