Code Room
Code reviewMedium
Question
Review this Java endpoint that mints loyalty points from a purchase amount.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
@PostMapping("/points/award")public ResponseEntity<PointsDto> award(@RequestBody AwardReq req) { int cents = req.getAmountCents(); // from request body int points = cents * 10; // 10 points per cent ledger.credit(req.getUserId(), points); return ResponseEntity.ok(new PointsDto(points));}Run or narrate your approach, then ask the coach.