CourseAI Engineering: The Complete Course · Module 10: Backend Engineering · part 78 of 105
Part 78 · Module 10: Backend Engineering

Lesson 4: Keep the returns rule out of the route

17 min read·13 Oct 2026
Module 10 · Lesson 4 · About 40 minutes · Needs: Lesson 1 of this module (a FastAPI route, Pydantic models)

The situation

Dev wants a "start a return" endpoint for the assistant. Aisha Rahman (cust-88) has a 4-pack of GlowLine bulbs with the wrong fitting, order 6150, delivered on 4 October. BrightCart's policy is 30 days from delivery, and the course date is 9 October 2026, so she is well inside it.

Then Priya asks for a command-line tool so her agents can start returns by hand. Two callers now need the same rule. This lesson builds the endpoint the quick way, watches the second caller drift, and rebuilds it in layers that keep one rule in one place.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.