feat: tenants to base structure - #76
Merged
Merged
Conversation
… tenant-specific provider validation
… to support polymorphic model links
…alidation and tenant support
…p for multi-tenancy support
…ery and error handling
- Conditionally drop foreign key constraint for non-SQLite databases
Clintonrocha98
approved these changes
Nov 3, 2025
Signed-off-by: Gabriel do Carmo Vieira <48625433+gvieira18@users.noreply.github.com>
fernanduandrade
approved these changes
Nov 4, 2025
danielhe4rt
marked this pull request as ready for review
November 4, 2025 16:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces multi-tenancy support to the Badge and Character modules by adding
tenant_idfields and enforcing tenant-aware logic throughout models, factories, DTOs, entities, validation, routes, and tests. It also updates relevant middleware and actions to ensure all operations are scoped to the correct tenant, and modifies tests to use tenant-specific data.Multi-tenancy support and enforcement:
tenant_idas a required attribute to theBadge,Character, andPastSeasonmodels, their factories, and their$fillablearrays to ensure all records are associated with a tenant. [1] [2] [3] [4] [5] [6]NewBadgeDTO) and entities (BadgeEntity) to require and serializetenant_id, and to expect it in their static constructors. [1] [2] [3] [4] [5]tenant_idin badge creation requests.Route and middleware updates:
VerifyIfHasTenantProviderMiddlewareto both badge and character API route groups to enforce tenant context on all endpoints. [1] [2]Tenant-aware logic in actions:
FindCharacterIdByUserIdaction to query characters by bothtenant_id(from the request) anduser_id, ensuring tenant isolation. [1] [2]userIdto usemodelIdfor improved provider/character linkage. [1] [2]Test updates for multi-tenancy:
tenant_idin payloads and headers. [1] [2] [3] [4] [5] [6] [7] [8]Factory improvements:
These changes collectively ensure all badge and character operations are properly scoped to a tenant, laying the groundwork for robust multi-tenant support.