def ForceOut(self, request, *args, **kwargs):
        companyInstance = Company.objects.get(
            id=self.kwargs["companyID_id"],
            owner_user=request.user.id
        )
        mySqlPositionInstance = Position.objects.get(
            id = request.data["positionID"]
        )
        updating = {
            "user": None
        }

        memSerial = MembersSerializer(instance=mySqlPositionInstance, data=updating, partial=True)
        memSerial.is_valid(raise_exception=True)
        memSerial.update(instance=mySqlPositionInstance, validated_data=memSerial.validated_data)

        return Response({})
 def RemoveFromInbox(self, request, *args, **kwargs):
     companyInstance = Company.objects.get(
         id=self.kwargs["companyID_id"],
         owner_user=request.user.id
     )
     mySqlPositionInstance = Position.objects.get(
         chart=request.data["chartID"],
         company=companyInstance.id,
         user=request.data["userID"],
     )
     updating = {
         "chart": None,
         "company":None
     }
     serial = MembersSerializer(instance=mySqlPositionInstance, data=updating, partial=True)
     serial.is_valid(raise_exception=True)
     serial.update(mySqlPositionInstance, updating)
     return Response({})
    def DoInvite(self, request, *args, **kwargs):
        currentUserInstance = request.user
        # checking if current is user is CEO or reciever
        invitationInstance = self.queryset.get(id=request.data['invitationID'])
        chartInstance = Chart.objects.get(id=invitationInstance.chart)
        companyInstance = Company.objects.get(id=invitationInstance.company)
        recieverProfileInstance = invitationInstance.receiver
        senderProfileInstance = invitationInstance.sender
        recieverUserInstance = MyUser.objects.get(id=recieverProfileInstance.userID)
        senderUserInstance = MyUser.objects.get(id=senderProfileInstance.userID)

        isCurrentUserApproveAsReciever = recieverUserInstance == currentUserInstance
        isCurrentUserApproveAsCEO = senderUserInstance == currentUserInstance

        if not isCurrentUserApproveAsCEO and not isCurrentUserApproveAsReciever:
            return Response({"message": _("You are not allowed to perform this operation")},
                            status=status.HTTP_401_UNAUTHORIZED)

        # partial update is here
        # it means we have to update an position
        if invitationInstance.isEmpty:
            positionInstance = Position.objects.get(id=invitationInstance.positionID)
            updated = {
                "user": recieverUserInstance.id,
                "post_date": datetime.now()
            }
            posSerializer = MembersSerializer(instance=positionInstance, data=updated, partial=True)
            posSerializer.is_valid(raise_exception=True)
            posSerializer.update(instance=positionInstance, validated_data=posSerializer.validated_data)
            invitationInstance.delete()
            return Response({}, status=status.HTTP_200_OK)

        newMember = {
            "company": companyInstance.id,
            "chart": chartInstance.id,
            "user": recieverUserInstance.id
        }
        posSerializer = MembersSerializer(data=newMember)
        posSerializer.is_valid(raise_exception=True)
        posSerializer.create(posSerializer.validated_data)
        invitationInstance.delete()
        return Response({}, status=status.HTTP_200_OK)