Fix publish application event not being sent

This commit is contained in:
Shrikant Sharat Kandula 2021-06-18 13:27:31 +05:30
parent 91bf527bea
commit 040d3b0cc4

View File

@ -78,13 +78,13 @@ public class ApplicationController extends BaseController<ApplicationService, Ap
@PostMapping("/publish/{applicationId}")
public Mono<ResponseDTO<Boolean>> publish(@PathVariable String applicationId) {
return applicationPageService.publish(applicationId)
.map(application -> {
// This event should parallel a similar event sent from the client, so we want it to be sent by the
// controller and not the service method.
applicationPageService.sendApplicationPublishedEvent(application);
// This will only be called when the publishing was successful, so we can always return `true` here.
return new ResponseDTO<>(HttpStatus.OK.value(), true, null);
});
.flatMap(application ->
// This event should parallel a similar event sent from the client, so we want it to be sent by the
// controller and not the service method.
applicationPageService.sendApplicationPublishedEvent(application)
// This will only be called when the publishing was successful, so we can always return `true` here.
.thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null))
);
}
@PutMapping("/{applicationId}/page/{pageId}/makeDefault")