From 4d8088e85a976bf02350f190104d499e8f30724b Mon Sep 17 00:00:00 2001 From: Mardone Date: Wed, 17 Apr 2024 11:41:48 -0300 Subject: [PATCH] Overrite perform_destroy repository --- bothub/api/v2/repository/serializers.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bothub/api/v2/repository/serializers.py b/bothub/api/v2/repository/serializers.py index 87f5da8d..e04fb522 100644 --- a/bothub/api/v2/repository/serializers.py +++ b/bothub/api/v2/repository/serializers.py @@ -1039,6 +1039,21 @@ def create(self, validated_data): return repository + def perform_destroy(self, instance): + celery_app.send_task( + "send_recent_activity", + [ + { + "user": self.context["request"].user.email, + "entity": "AI", + "action": "DELETE", + "entity_name": instance.name, + "intelligence_id": instance.owner.organization.id, + } + ], + ) + return super().perform_destroy(instance) + def get_intents(self, obj): return obj.get_formatted_intents()