Changeset 43c9090 for src/main/java/finki/it/terapijamkbackend/spring/controllers/CouponController.java
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/finki/it/terapijamkbackend/spring/controllers/CouponController.java
r743de55 r43c9090 3 3 import finki.it.terapijamkbackend.spring.services.CouponsService; 4 4 import jakarta.persistence.EntityNotFoundException; 5 import jakarta.transaction.Transactional;6 5 import org.springframework.beans.factory.annotation.Autowired; 7 6 import org.springframework.http.HttpStatus; … … 20 19 @PutMapping("/createCoupon") 21 20 public ResponseEntity<Coupon> updateCoupon(@RequestBody Coupon couponItem) { 22 System.out.println(couponItem);23 21 if (couponItem.getTitle() == null || couponItem.getCode() == null) { 24 22 return ResponseEntity.badRequest().build(); … … 53 51 coupon.setCode(newCouponData.getCode()); 54 52 coupon.setDescription(newCouponData.getDescription()); 55 couponService.save(coupon); // Save the updated coupon53 couponService.save(coupon); 56 54 57 55 return ResponseEntity.ok().build(); 58 56 } 57 58 59 @GetMapping("/getCouponNames") 60 public ResponseEntity<List<String>> getCouponNames() { 61 List<String> couponNames = couponService.getCouponNames(); 62 return ResponseEntity.ok(couponNames); 63 } 59 64 }
Note:
See TracChangeset
for help on using the changeset viewer.