Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize project-based lookup on individual element access #1812

Open
wants to merge 52 commits into
base: main
Choose a base branch
from

Conversation

bctcvai
Copy link
Member

@bctcvai bctcvai commented Sep 10, 2024

This PR adds project based access when accessing elements by ID.

This can occur via individual get accesses in REST (e.g. /rest/Localization/foo), Foreign Key relationships, and ManyToMany relationships.

The psuedo-code in any case is
Object.objects.filter(project=foo, id=baz) or Object.object.filter(project=foo,id__in=baz) vs Object.objects.filter(id=baz) or Object.objects.filter(id__in=baz). This was accomplished via adding a ProjectLookup table model which is populated via triggers on editing Media, State, or Localization elements.

ForeignKeyField usage was replaced with ForeignObject usage which incorporates both project and related in the relationship upon access.

ManyToManyFields were replaced with new ManyToManyFields which utilize a custom table and multiple through fields. This allows a similar operation to occur such that project is used in any lookup between models where-in it is appropriate and performance-oriented.

This PR requires additional migrations which will be backported to stable

Add utility to backfill lookup table
…oint"

This reverts commit 69623cb340e993dc1f86343bd308b9f9d28d57b7.
# Conflicts:
#	api/main/rest/localization.py
#	api/main/rest/media.py
#	api/main/rest/state.py
@bctcvai
Copy link
Member Author

bctcvai commented Sep 10, 2024

Not complete yet as State model needs to be addresses for its two ManyToMany fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant