fix(customer-auth): make organization_id optional at registration
Requiring organization_id broke the current app, which does not send it. When it is left out and the database has exactly one organization, the customer now joins that one, so the app works unchanged. A sent organization_id must still exist, and with several organizations and none sent registration is refused with a clear message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a3cb7dd5fd
commit
8bf2fe5585
@@ -71,8 +71,10 @@ func (v *CustomerAuthValidatorImpl) ValidateRegisterStartRequest(req *contract.R
|
||||
}
|
||||
|
||||
// Validate organization
|
||||
if _, err := uuid.Parse(strings.TrimSpace(req.OrganizationID)); err != nil {
|
||||
return errors.New("organization_id must be a valid UUID"), constants.ValidationErrorCode
|
||||
if orgID := strings.TrimSpace(req.OrganizationID); orgID != "" {
|
||||
if _, err := uuid.Parse(orgID); err != nil {
|
||||
return errors.New("organization_id must be a valid UUID"), constants.ValidationErrorCode
|
||||
}
|
||||
}
|
||||
|
||||
// Validate birth date
|
||||
|
||||
Reference in New Issue
Block a user