-
Notifications
You must be signed in to change notification settings - Fork 2
merge check indexation status and reindex all in one endpoint #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
466e99b
fb777ec
b77ceeb
913f818
0bca8c6
13facf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ | |
* @author Franck Lecuyer <franck.lecuyer at rte-france.com> | ||
*/ | ||
|
||
@SuppressWarnings("checkstyle:RegexpSingleline") | ||
@RestController | ||
@RequestMapping(value = "/" + StudyApi.API_VERSION) | ||
@Tag(name = "Study server") | ||
|
@@ -1325,6 +1326,16 @@ public ResponseEntity<Void> reindexStudy(@Parameter(description = "study uuid") | |
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@PostMapping(value = "/studies/{studyUuid}/reindex-if-needed") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be better to keep the endpoint |
||
@Operation(summary = "reindex the study if needed") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "Study reindexed"), | ||
@ApiResponse(responseCode = "404", description = "The study or network doesn't exist")}) | ||
public ResponseEntity<Void> reindexStudyIfNeeded(@Parameter(description = "study uuid") @PathVariable("studyUuid") UUID studyUuid) { | ||
studyService.reindexStudyIfNeeded(studyUuid); | ||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@PostMapping(value = "/studies/{studyUuid}/notification") | ||
@Operation(summary = "Create study related notification") | ||
@ApiResponses(value = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1674,6 +1674,14 @@ public void reindexStudy(UUID studyUuid) { | |
reindexStudy(studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND))); | ||
} | ||
|
||
@Transactional | ||
public void reindexStudyIfNeeded(UUID studyUuid) { | ||
StudyIndexationStatus status = getStudyIndexationStatus(studyUuid); | ||
achour94 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make private |
||
if (status == StudyIndexationStatus.NOT_INDEXED) { | ||
reindexStudy(studyUuid); | ||
} | ||
} | ||
|
||
@Transactional | ||
public StudyIndexationStatus getStudyIndexationStatus(UUID studyUuid) { | ||
StudyEntity study = studyRepository.findById(studyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND)); | ||
|
Uh oh!
There was an error while loading. Please reload this page.