Skip to content

Commit

Permalink
fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed May 23, 2022
1 parent 3a171b2 commit 552fe65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bothub/api/grpc/repository/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from bothub.common.models import Repository
from weni.protobuf.intelligence import repository_pb2

from bothub.utils import internal_fields
from bothub.utils import internal_serializer_fields


class RepositoryProtoSerializer(proto_serializers.ModelProtoSerializer):
Expand All @@ -17,7 +17,7 @@ class RepositoryProtoSerializer(proto_serializers.ModelProtoSerializer):
class Meta:
model = Repository
proto_class = repository_pb2.Repository
fields = internal_fields
fields = internal_serializer_fields

def get_owner__nickname(self, repository: Repository):
return repository.owner.nickname
Expand Down
4 changes: 2 additions & 2 deletions bothub/api/v2/internal/repository/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from bothub.api.v2.repository.serializers import RepositoryCategorySerializer
from bothub.common.models import Repository

from bothub.utils import internal_fields
from bothub.utils import internal_serializer_fields


class InternalRepositorySerializer(serializers.ModelSerializer):
Expand All @@ -14,7 +14,7 @@ class InternalRepositorySerializer(serializers.ModelSerializer):

class Meta:
model = Repository
fields = internal_fields
fields = internal_serializer_fields

def get_owner__nickname(self, repository: Repository):
return repository.owner.nickname
Expand Down
1 change: 1 addition & 0 deletions bothub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ def check_module_permission(claims, user):
return True
return False


internal_serializer_fields = [
"uuid",
"name",
Expand Down

0 comments on commit 552fe65

Please sign in to comment.