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:
efrilm
2026-09-30 18:16:31 +07:00
co-authored by Claude Opus 5.5
parent a3cb7dd5fd
commit 8bf2fe5585
4 changed files with 55 additions and 14 deletions
+3 -2
View File
@@ -17,8 +17,9 @@ type RegisterStartRequest struct {
Name string `json:"name" binding:"required"`
BirthDate string `json:"birth_date" binding:"required"`
// The organization (brand) the customer registers with. A customer belongs to one
// organization; the app sends the one it is built for.
OrganizationID string `json:"organization_id" binding:"required"`
// organization. Optional: when it is left out and the database has exactly one
// organization, the customer joins that one.
OrganizationID string `json:"organization_id,omitempty"`
}
type RegisterVerifyOtpRequest struct {