RaspberryPiFoundation / editor-api

Code Editor backend
https://editor.raspberrypi.org
GNU Affero General Public License v3.0
22 stars 4 forks source link

Allow teacher invitation to be accepted multiple times #351

Closed floehopper closed 1 week ago

floehopper commented 1 week ago

Status

Points for consideration:

What's changed?

This was unnecessarily strict which made testing in development a bit harder than it needed to be.

Previously we were always trying to create a new teacher role in the school and responding with a 422 Unprocessalbe entity (with a validation error) if the user already had that role. Now we respond with 200 OK and leave the existing role in place. We also set TeacherInvitation#accepted_at if it hasn't already been set.

Steps to perform after deploying to production

None.