Return the created location from CreateTenantLocation so its locationid is available immediately

The store/branch QR code the app scans is just {tenantid, locationid} JSON, but the
onboarding response previously discarded the DB-assigned locationid, so the frontend
had no way to render a store's QR right after onboarding without a separate lookup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 11:08:57 +05:30
parent d4cbf92661
commit 7db81c0e68
2 changed files with 14 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ func (s *tenantService) UpdateStaff(user models.User) error {
}
func (s *tenantService) CreateTenantLocation(data models.Tenantlocations) map[string]interface{} {
err := s.repo.CreateTenantLocation(data)
created, err := s.repo.CreateTenantLocation(data)
if err != nil {
return map[string]interface{}{
"code": http.StatusConflict,
@@ -116,10 +116,14 @@ func (s *tenantService) CreateTenantLocation(data models.Tenantlocations) map[st
}
}
// "details" carries back the DB-assigned locationid so the frontend can
// build the store's QR code (tenantid+locationid) immediately after
// onboarding, instead of having to look the new location up separately.
return map[string]interface{}{
"code": http.StatusCreated,
"message": "Tenant Location Successfully Created",
"status": true,
"details": created,
}
}