* feat: add backend validation for conflicting team slugs during org onboarding - Added findOwnedTeamsByUserId method to TeamRepository - Created buildTeamsAndInvites method in BaseOnboardingService that automatically: - Detects teams with same slug as organization - Marks conflicting teams for migration (isBeingMigrated: true) - Filters empty team names and invite emails - Updated BillingEnabledOrgOnboardingService to use new method - Updated SelfHostedOnboardingService to use new method - Added comprehensive tests for slug conflict scenarios This ensures backend validation even if frontend is bypassed, preventing slug conflicts during organization creation. All inheriting classes automatically get this validation without code changes. * refactor: use TeamRepository in listOwnedTeamsHandler Refactored listOwnedTeamsHandler to use TeamRepository.findOwnedTeamsByUserId instead of direct Prisma queries. This: - Reduces code duplication - Ensures consistency across the codebase - Follows repository pattern - Makes the handler more maintainable * fix: update tests to use renamed buildTeamsAndInvites method - Renamed testFilterTeamsAndInvites to testBuildTeamsAndInvites - Made test wrapper method async to match the async buildTeamsAndInvites - Added orgSlug parameter to all test calls - Updated all 9 test cases to use await with the new method signature - Fixed lint warnings by using proper types instead of 'any' - Imported OnboardingIntentResult and User types - Used Pick<User> for mockUser type - Removed all 'as any' type casts Fixes test failures where filterTeamsAndInvites was renamed to buildTeamsAndInvites in the base service. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: mock TeamRepository in tests to prevent database calls Added vi.mock for TeamRepository to avoid database calls in unit tests. The buildTeamsAndInvites method now calls ensureConflictingSlugTeamIsMigrated which uses TeamRepository.findOwnedTeamsByUserId(). Mocking this prevents Prisma errors in CI while keeping the tests focused on filtering logic. The mock returns an empty array so no teams are found for migration, allowing the tests to verify the filtering behavior without database access. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: improve readability of ensureConflictingSlugTeamIsMigrated Refactored the conditional logic in ensureConflictingSlugTeamIsMigrated for better readability while preserving exact behavior. Changed from manual array manipulation to using .map() for updating team migration status. This is a cosmetic change with no functional differences. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>