feat: add Platform database model that defines the admin roles for each platform AAI-388#80
Merged
Merged
Conversation
…k well with unique constraints on platform
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a Platform model to the database to define admin roles for each platform, enabling platform-specific admin access control. It updates the existing PlatformMembership model to reference the new Platform model and adds endpoints for admins to view which platforms they can manage.
- Add Platform model with admin role associations
- Update PlatformMembership to use foreign key relationship to Platform
- Add endpoint for users to check their admin platforms
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| db/models.py | Adds Platform model with admin roles relationship and updates PlatformMembership to reference Platform |
| routers/user.py | Adds endpoint to get platforms where current user has admin privileges |
| routers/admin.py | Updates user listing to filter by admin's platform access |
| migrations/ | Database migrations to create Platform table and update constraints |
| tests/ | Updates test files to use new Platform model and factory patterns |
| db/admin.py | Adds Platform model to admin interface |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
amandazhuyilan
previously approved these changes
Sep 26, 2025
amandazhuyilan
left a comment
Contributor
There was a problem hiding this comment.
Looks great :) just one more thing
amandazhuyilan
approved these changes
Sep 26, 2025
amandazhuyilan
left a comment
Contributor
There was a problem hiding this comment.
Thanks for making the change!
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.
Description
AAI-388: add a Platform model to the database. Add an endpoint to check which platforms the current user is an admin for (to be used by the frontend in guiding which views admins see).
Changes
Platformmodel to the databasePlatformMembershiprefer toPlatform/me/platforms/admin-rolesendpoint that returns which platforms the admin is a user of./admin/usersupdated to only return users who are members of the admin's platformsChecklist
How to Test Manually (if necessary)
Run
uv run pytest