-
Notifications
You must be signed in to change notification settings - Fork 82
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
Enum refactoring #978
Enum refactoring #978
Conversation
backend/dataall/modules/dataset_sharing/db/share_object_models.py
Outdated
Show resolved
Hide resolved
@@ -52,15 +52,15 @@ def resolve_user_role(context: Context, source: Dataset, **kwargs): | |||
.first() | |||
) | |||
if share and ( | |||
share.owner == context.username or share.principalId in context.groups | |||
share.owner == context.username or share.principalId in context.groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if these formatting changes are needed in this file
updated = 'updated' | ||
label = 'label' | ||
|
||
|
||
class DatasetTablePreviewStatus(GraphQLEnumMapper): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move this enum to datasets_base/constants/enums.py
and get rid of this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum is only used in dataall/modules/datasets/api/table/types.py:100
for the class DatasetTablePreviewResult
that as far as I see it is not used. Maybe we can delete both the Enum and the gqlObjectType
@@ -74,8 +76,8 @@ def upgrade(): | |||
print('Updating datasets...') | |||
datasets: [Dataset] = session.query(Dataset).all() | |||
for dataset in datasets: | |||
if dataset.confidentiality not in ['Unclassified', 'Official', 'Secret']: | |||
dataset.confidentiality = 'Unclassified' | |||
if dataset.confidentiality not in ConfidentialityClassification: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this is working?
you could do something like:
if not any(value == dataset.confidentiality for value in ConfidentialityClassification.__dict__.values()):
Check if enum contains value is now python 3.10 compatible
Check if enum contains value is now python 3.10 compatible Remove unused enum and object DatasetTablePreview rename enum folder to 'common/enums.py'
Hi @SofiaSazonova @dlpzx - what is left to be done before we can push forward testing and approving this PR... I see we have some I am open for alternative approaches / further discussion - want to align so I can help review and push this PR through |
@noah-paige I moved all enums to "common" folder since they are used not only in api, but also in models and etc. If you or @dlpzx insist I can move them back to api folder, but in my opinion it's odd)) |
tests/modules/datasets/conftest.py
Outdated
name: str, | ||
owner: str, | ||
group: str, | ||
confidentiality: str = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove additional indentation
tests/modules/datasets/conftest.py
Outdated
label: str | ||
organization: Organization, | ||
environment: Environment, | ||
label: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove additional indentation
In my opinion there is no need to create a new layer Now, which one should it be? We can argue that since it is business logic they should be defined as part of Another idea that I got is to rename the enums, instead of |
I agree, that naming |
Also, there is no |
So, I moved enums to services and renamed them as |
Overall changes look good @SofiaSazonova. I am doing a last test in AWS before approving
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in AWS
Feature or Bugfix
Detail
Security N/A
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.