Code Room
Code reviewMediumcr-g355
Subject Input validationLevel Mid–Senior~20 minCommon in Code quality & review interviewsIndustries Software development

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.

Talk through your review
Code to reviewjava
@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.