Skip to content

Commit

Permalink
activeStatus bool added for CognitionSchema (#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshugt16 authored Oct 25, 2024
1 parent 3fd043c commit b674b39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions kairon/api/app/routers/bot/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ async def delete_cognition_schema(

CognitionDataProcessor.validate_collection_name(current_user.get_bot(), metadata['collection_name'])

metadata.activeStatus = False
metadata.save()

actor = ActorFactory.get_instance(ActorType.callable_runner.value)
actor.execute(cognition_processor.delete_cognition_schema, schema_id, current_user.get_bot(),
user=current_user.get_user())
Expand Down
1 change: 1 addition & 0 deletions kairon/shared/cognition/data_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CognitionSchema(Auditlog):
user = StringField(required=True)
bot = StringField(required=True)
timestamp = DateTimeField(default=datetime.utcnow)
activeStatus = BooleanField(default=True)

meta = {"indexes": [{"fields": ["bot"]}]}

Expand Down
2 changes: 1 addition & 1 deletion kairon/shared/cognition/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def list_cognition_schema(self, bot: Text):
:param bot: bot id
:return: yield dict
"""
for value in CognitionSchema.objects(bot=bot):
for value in CognitionSchema.objects(bot=bot, activeStatus=True):
final_data = {}
item = value.to_mongo().to_dict()
metadata = item.pop("metadata")
Expand Down

0 comments on commit b674b39

Please sign in to comment.