Exemplo n.º 1
0
 def invite_list_user(self, request, *args, **kwargs):
     serializer = InviteListSerializer(data=request.data, many=True)
     serializer.is_valid(raise_exception=True)
     invite_list_service = InviteListService()
     valid_user, invalid_user = invite_list_service.separation_data(
         serializer.validated_data)
     for user in valid_user:
         UserService.invite(email=user.get('email'), name=user.get('name'))
     data = {'valid_user': valid_user, 'invalid_user': invalid_user}
     return Response(data=data, status=status.HTTP_201_CREATED)
Exemplo n.º 2
0
 def create(self, request, *args, **kwargs):
     invite_serializer = InviteSerializer(data=request.data)
     if invite_serializer.is_valid(raise_exception=True):
         email = request.data.get('email')
         name = request.data.get('name')
         res = UserService.invite(email, name)
         return Response(res)