Open
Conversation
varnie
reviewed
Jan 3, 2024
backend/src/application/app_core.py
Outdated
| if tenant_id: | ||
| g.tenant_id = tenant_id | ||
| else: | ||
| g.tenant_id = 2 |
varnie
reviewed
Jan 3, 2024
backend/src/application/app_core.py
Outdated
|
|
||
| def _store_tenant_id_in_context(): | ||
| g.tenant_id = None | ||
| tenant_id = request.headers.get("X-Tenant-ID") |
Member
There was a problem hiding this comment.
I suppose the PR is not complete, because I don't see how this value gets supplied from the frontend or something, right?
varnie
reviewed
Jan 3, 2024
backend/src/database/tenant.py
Outdated
| # Call the original filter method with the provided criteria | ||
| query = super(TenantScopedQuery, self).filter(*criteria) | ||
|
|
||
| logging.error(f"Query: {query}") |
varnie
reviewed
Jan 3, 2024
| query_class = TenantScopedQuery | ||
|
|
||
| # Assuming every table has a 'company_id' field | ||
| company_id = db.Column(db.Integer, nullable=False, index=True) |
Member
There was a problem hiding this comment.
Is it needed here really? I see this company_id in all the descendants of this table which overwrite this one. I'd say yes, it is needed, but why do we have tons of company_id = db.Column(db.Integer, db.ForeignKey('company.id', ondelete='SET NULL'), server_default="1", nullable=False) here and there if we can put this line directly into this class?
varnie
reviewed
Jan 3, 2024
backend/src/database/tenant.py
Outdated
|
|
||
| def filter_by(self, **kwargs): | ||
| logging.error(f"Filter by kwargs: {kwargs}") | ||
| super(TenantScopedQuery, self).filter_by(**kwargs) |
Member
There was a problem hiding this comment.
should this method return something?
…nant() when no filters in query & add filter_by to db.session.query calls
# Conflicts: # backend/src/application/app_core.py # backend/src/application/schemas.py
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.
No description provided.