Open glenpike opened 5 years ago
Owner is a flag used for representing the current owner of the Dojo. There should
be only one per Dojo, and only the owner of the Dojo can pass this ownership to somebody else (nb, that's never been enforced in the DB).
As per se, forcing the owner in the payload to 0 won't help as https://github.com/CoderDojo/cp-dojos-service/blob/master/lib/save-usersdojo.js#L36 checks for "any" mutation.
The fact that the owner value is missing from the payload is weird by itself, as I don't believe we mutate the payload (at least not that field) in the frontend. Note however that the DB does not enforce it that field to be set. If users are being created without the owner flag (not 0 nor 1), it might create some issues in the future, but I havent been able to reproduce it in dev (adding children through My children page or the booking flow). You might want to check the prod if there are any relationship (cd_usersdojos) not having a "owner" set to anything but 0 or 1.
Thx @Wardormeur :) I wonder if this happened because the person who signed up applied to be a Volunteer and something in that flow isn't correct?
I did try with a newly created volunteer account (joined through the "Join" button, my previous comment was indeed describing another flow, my bad), and had no issue on the dev stack. It could be that the user is also a parent, that it's an old account that might be glitched (ref previous comment), or ..?
I had a parent sign-up as a volunteer by mistake. I was told that I could change their role, so accepted, then tried this out.
I got an error on the screen (need to look at error messages??):
The request
POST: https://zen.coderdojo.com/api/2.0/dojos/save-usersdojos
with body:Errors with the following:
Paired with Ant and tried copying the request and running as cURL, but changing the owner value to 0 as we assumed that the champion === owner, the message that came back was:
So guessing there's some issue there :)