fix: auto-create default branch on cafe registration + backfill existing
CI/CD / CI · API (dotnet build + test) (push) Successful in 42s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 34s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m3s
CI/CD / CI · Admin Web (tsc) (push) Successful in 34s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Has been cancelled

- VerifyRegisterAsync: create a Branch named after the café alongside
  the Café and Owner, so new owners can use the dashboard immediately
  without hitting the "select a branch" gate
- PlatformDataSeeder: EnsureDefaultBranchesAsync runs on every boot and
  creates a default branch for any existing café that has none (covers
  cafés registered before this fix)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-31 20:53:33 +03:30
parent 255695e8ae
commit 5ae350e25b
2 changed files with 48 additions and 0 deletions
+10
View File
@@ -367,6 +367,15 @@ public class AuthService : IAuthService
PlanTier = PlanTier.Free,
};
// Auto-create a default main branch so the owner can start using the
// dashboard immediately without hitting the "select a branch" gate.
var defaultBranch = new Branch
{
CafeId = cafe.Id,
Name = cafeName,
IsActive = true,
};
var owner = new Employee
{
CafeId = cafe.Id,
@@ -376,6 +385,7 @@ public class AuthService : IAuthService
};
_db.Cafes.Add(cafe);
_db.Branches.Add(defaultBranch);
_db.Employees.Add(owner);
await _db.SaveChangesAsync(cancellationToken);