Commit f30e23dd authored by Sumaiyya Burney's avatar Sumaiyya Burney

Adds endpoint skeletons

parent f27e4b90
package com.nisum.ascend.promotions.controller; package com.nisum.ascend.promotions.controller;
import com.nisum.ascend.promotions.dto.PromotionDto;
import com.nisum.ascend.promotions.model.Promotion;
import com.nisum.ascend.promotions.repository.PromotionRepository; import com.nisum.ascend.promotions.repository.PromotionRepository;
import com.nisum.ascend.promotions.service.PromotionService; import com.nisum.ascend.promotions.service.PromotionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.ArrayList;
@RestController @RestController
@RequestMapping("/api/promos") @RequestMapping("/api/promos")
...@@ -12,4 +18,40 @@ public class PromotionsController { ...@@ -12,4 +18,40 @@ public class PromotionsController {
@Autowired @Autowired
PromotionService promotionService; PromotionService promotionService;
@GetMapping()
public Flux<ResponseEntity<PromotionDto>> getAllPromotions(@RequestParam(required = false) String itemSku){
//TODO: get all promos OR promos by item SKU
return null;
}
@GetMapping("/{id}")
public Mono<ResponseEntity<PromotionDto>> getPromotionById(@PathVariable String id){
//TODO: get promo by ID
return null;
}
@PostMapping()
public Mono<ResponseEntity<PromotionDto>> createPromotion(@RequestBody Promotion newPromotion){
//TODO: create promotion
return null;
}
@PostMapping("/bulkSearch")
public Flux<ResponseEntity<PromotionDto>> bulkSearchPromotionsByItemSku(){
//TODO: bulk search by list of item SKUs
return null;
}
@PutMapping("/{promoId}")
public Mono<ResponseEntity<PromotionDto>> updatePromotionById(@PathVariable String promoId, @RequestBody Promotion newPromotion){
//TODO: update promotion
return null;
}
@DeleteMapping("/{promoId}")
public Mono<ResponseEntity<PromotionDto>> deletePromotionById(@PathVariable String promoId){
//TODO: delete promotion
return null;
}
} }
server.port=8081 server.port=8081
spring.data.mongodb.uri=mongodb+srv://admin:${db.password}@inventory-promotions.d4nfz.mongodb.net/products-promotions-db?retryWrites=true&w=majority spring.data.mongodb.uri=mongodb+srv://admin:${db.password}@inventory-promotions.d4nfz.mongodb\
.net/${spring.data.mongodb.database}?retryWrites=true&w=majority
spring.data.mongodb.database=products-promotions-db spring.data.mongodb.database=products-promotions-db
\ No newline at end of file
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