def destroy(self, request: request.Request, pk=None, **kwargs): # type: ignore try: person = Person.objects.get(team=self.team, pk=pk) delete_person( person.uuid, person.properties, person.is_identified, delete_events=True, team_id=self.team.pk ) person.delete() return response.Response(status=204) except Person.DoesNotExist: raise NotFound(detail="Person not found.")
def destroy(self, request: request.Request, pk=None): # type: ignore team = request.user.team person = Person.objects.get(team=team, pk=pk) # TODO: Probably won't need this after a while events = Event.objects.filter(team=team, distinct_id__in=person.distinct_ids) events.delete() delete_person(person.uuid, delete_events=True, team_id=team.pk) person.delete() return response.Response(status=204)
def destroy(self, request: request.Request, pk=None, **kwargs): # type: ignore try: person = Person.objects.get(team=self.team, pk=pk) events = Event.objects.filter(team=self.team, distinct_id__in=person.distinct_ids) events.delete() delete_person(person.uuid, delete_events=True, team_id=self.team.pk) person.delete() return response.Response(status=204) except Person.DoesNotExist: raise NotFound(detail="Person not found.")
def destroy(self, request: request.Request, pk=None, **kwargs): # type: ignore try: person = Person.objects.get(team=self.team, pk=pk) person_id = person.id delete_person( person.uuid, person.properties, person.is_identified, delete_events=True, team_id=self.team.pk ) person.delete() log_activity( organization_id=self.organization.id, team_id=self.team_id, user=request.user, # type: ignore item_id=person_id, scope="Person", activity="deleted", detail=Detail(name=str(person_id)), ) return response.Response(status=204) except Person.DoesNotExist: raise NotFound(detail="Person not found.")