-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from Ilhasoft/feature/grpc-whatsapp-integrations
Feature/grpc whatsapp integrations
- Loading branch information
Showing
6 changed files
with
103 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from connect.api.grpc.organization.services import OrganizationService | ||
from weni.protobuf.connect import organization_pb2_grpc | ||
|
||
|
||
def grpc_handlers(server): | ||
organization_pb2_grpc.add_OrganizationControllerServicer_to_server( | ||
OrganizationService.as_servicer(), server | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django_grpc_framework.proto_serializers import ProtoSerializer | ||
from rest_framework import serializers | ||
from weni.protobuf.connect import organization_pb2 | ||
|
||
|
||
class OrganizationSerializer(ProtoSerializer): | ||
uuid = serializers.CharField(required=True) | ||
|
||
class Meta: | ||
proto_class = organization_pb2.OrganizationResponse |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from connect.common.models import Organization | ||
from weni.protobuf.connect.organization_pb2 import OrganizationResponse | ||
from django_grpc_framework import generics | ||
|
||
|
||
class OrganizationService(generics.GenericService): | ||
def Retrieve(self, request, context): | ||
|
||
flow_organization_uuid = request.uuid | ||
organization = Organization.objects.get(project__flow_organization=flow_organization_uuid) | ||
|
||
return OrganizationResponse( | ||
uuid=str(organization.uuid), | ||
name=organization.name, | ||
description=organization.description, | ||
inteligence_organization=organization.inteligence_organization, | ||
extra_integration=organization.extra_integration, | ||
is_suspended=organization.is_suspended, | ||
) |
This file contains 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