-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(organizations): add
owner_label
field to AssetSerializer
TAS…
…K-1181 (#5312) ### 📣 Summary Added `owner_label` field to the Asset API to clarify ownership information, dynamically reflecting either the owner's username or the organization's name. ### 📖 Description The `owner_label` field in the Asset API now dynamically displays: - The username of the asset owner if the organization is not a multi-member organization (MMO). - The name of the organization if the organization is a multi-member organization (MMO) and the user is the organization owner. This enhancement improves clarity by providing contextual ownership details directly in the API response. ### 👷 Description for instance maintainers This update introduces a new owner_label field in the Asset serializer: - The field logic dynamically evaluates the organization's multi-member status (is_mmo) and ownership (is_owner). - Efficient database queries and optimizations ensure minimal impact on performance. ### 👀 Preview steps 1. ℹ️ Have an account and at least one asset in a project. 2. Ensure the asset belongs to a user who is also an organization owner. 3. 🟢 Verify that the API response for the asset includes owner_label reflecting the username of the owner. 4. Change the organization's status to a multi-member organization (enable is_mmo). 5. 🟢 Verify that the owner_label in the API response now reflects the organization's name. 6. Transfer ownership of the organization to a different user. 7. 🟢 Verify that the owner_label reverts to the original owner's username. ### 💭 Notes - Testing: Unit tests were added to validate the owner_label behavior under various conditions, including ownership changes and multi-member organization scenarios. - Performance: The implementation minimizes additional queries by prefetching related data and leveraging efficient annotations. - Scalability: The logic is designed to handle a large number of assets and organizations without introducing significant overhead. --------- Co-authored-by: Olivier Leger <olivierleger@gmail.com>
- Loading branch information
1 parent
be25956
commit f5e9183
Showing
5 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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