Code Room
Code reviewHardcr-g361
Subject Missing validationLevel Senior–Staff~25 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python user-update endpoint that spreads the request body onto the model.

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 reviewpython
@app.put('/account')def update_account():    body = request.get_json()    user = current_user()    for key, value in body.items():        setattr(user, key, value)   # apply all submitted fields    db.session.commit()    return jsonify(user.to_dict())
Run or narrate your approach, then ask the coach.