Commit 7db4c98f authored by Ben Anderson's avatar Ben Anderson

Changed post route to return a response entity instead of a Mono

parent 934097a6
......@@ -14,6 +14,7 @@ import reactor.core.publisher.Mono;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping("/api/promos")
......@@ -39,8 +40,10 @@ public class PromotionsController {
}
@PostMapping("")
public Mono<PromotionDto> createPromotion(@RequestBody Promotion newPromotion){
return promotionService.createPromotion(newPromotion).onErrorMap(throwable -> new PromotionAlreadyExistsException());
public ResponseEntity<Mono<PromotionDto>> createPromotion(@RequestBody Promotion newPromotion){
Mono<PromotionDto> responseData = promotionService.createPromotion(newPromotion)
.onErrorResume(throwable -> Mono.error(new PromotionAlreadyExistsException()));
return ResponseEntity.ok(responseData);
}
@PostMapping("/bulkSearch")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment