-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feature/grpc #550
Feature/grpc #550
Conversation
bothub/api/grpc/user/services.py
Outdated
|
||
return serializer.message | ||
|
||
def remove_user_permission(self, org: Organization, user: User, permission: 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.
Couldn't that be a function outside the class? If you need to use this functionality elsewhere in the code, you will have to rewrite it, causing duplicate code
bothub/api/grpc/user/services.py
Outdated
permissions = self.get_user_permissions(org, user) | ||
permissions.delete() | ||
|
||
def set_user_permission(self, org: Organization, user: User, permission: int): |
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.
Couldn't that be a function outside the class? If you need to use this functionality elsewhere in the code, you will have to rewrite it, causing duplicate code
bothub/utils.py
Outdated
@@ -324,3 +351,54 @@ class CountSubquery(Subquery): | |||
|
|||
def __init__(self, queryset, output_field=None, **extra): | |||
super().__init__(queryset, output_field, **extra) | |||
|
|||
|
|||
class AbstractService: |
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.
does it make sense to call yourself "Abstract Service"? since it implements specific methods? Perhaps it would be necessary to change the nomenclature.
Why is it called "Abstract" if it doesn't have any abstract methods?
bothub/utils.py
Outdated
) | ||
|
||
|
||
class AbstractUserService(generics.GenericService): |
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.
the comments cited above are also replicated here
grpc.StatusCode.NOT_FOUND, f"User:{request.user_email} not found!" | ||
) | ||
|
||
def get_orgs(self, user: User): |
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.
Couldn't that be a function outside the class? If you need to use this functionality elsewhere in the code, you will have to rewrite it, causing duplicate code
from bothub.protos import organization_pb2 | ||
|
||
|
||
class SerializerUtils(object): |
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.
here you used Serializer at the beginning of the class, in the others you used it at the end of the name. It would be interesting to standardize
key: value for key, value in data.items() if key not in ["id", "user_email"] | ||
} | ||
|
||
def _user_has_permisson(self, user: User, org: Organization) -> bool: |
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.
Couldn't that be a function outside the class? If you need to use this functionality elsewhere in the code, you will have to rewrite it, causing duplicate code
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.
The code is fine, but maybe you should think about organizing the code better. Abuse of MVC, placing business rules in the model. Do not use inheritance to reuse code, among other things. This way we avoid code smells and future problems
update max length nickname repository owner
SonarCloud Quality Gate failed.
|
No description provided.