From 6d5c0a43d46d780ccc47328c7851021ad99796f1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 30 Dec 2024 01:59:38 -0500 Subject: [PATCH] init journal index in migration --- common/setup.py | 2 ++ users/views/account.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/setup.py b/common/setup.py index 5a8a6e0f..2ee72983 100644 --- a/common/setup.py +++ b/common/setup.py @@ -4,6 +4,7 @@ from loguru import logger from catalog.search.models import Indexer from common.models import JobManager +from journal.models import JournalIndex from takahe.models import Config as TakaheConfig from takahe.models import Domain as TakaheDomain from takahe.models import Identity as TakaheIdentity @@ -127,6 +128,7 @@ class Setup: # Create search index if not exists Indexer.init() + JournalIndex.instance().initialize_collection() # Register cron jobs if not yet if settings.DISABLE_CRON_JOBS and "*" in settings.DISABLE_CRON_JOBS: diff --git a/users/views/account.py b/users/views/account.py index a0da2d89..c503c6aa 100644 --- a/users/views/account.py +++ b/users/views/account.py @@ -229,7 +229,7 @@ def clear_data_task(user_id): remove_data_by_user(user.identity) Takahe.delete_identity(user.identity.pk) user.clear() - index = JournalIndex(user) + index = JournalIndex.instance() index.delete_by_owner(user.identity.pk) logger.warning(f"User {user_str} data cleared.")