def delete_phone_numbers_for_owners(owner_ids): for ids in chunked(owner_ids, 50): results = VerifiedNumber.get_db().view( 'sms/verified_number_by_owner_id', keys=ids, include_docs=True ) soft_delete_docs([row['doc'] for row in results], VerifiedNumber)
def delete_reminders_for_cases(domain, case_ids): handler_ids = CaseReminderHandler.get_handler_ids( domain, reminder_type_filter=REMINDER_TYPE_DEFAULT) for ids in chunked(case_ids, 50): keys = [[domain, handler_id, case_id] for handler_id in handler_ids for case_id in ids] results = CaseReminder.get_db().view( 'reminders/by_domain_handler_case', keys=keys, include_docs=True) soft_delete_docs([row['doc'] for row in results], CaseReminder)
def delete_reminders_for_cases(domain, case_ids): handler_ids = CaseReminderHandler.get_handler_ids( domain, reminder_type_filter=REMINDER_TYPE_DEFAULT) for ids in chunked(case_ids, 50): keys = [[domain, handler_id, case_id] for handler_id in handler_ids for case_id in ids] results = CaseReminder.get_db().view( 'reminders/by_domain_handler_case', keys=keys, include_docs=True ) soft_delete_docs([row['doc'] for row in results], CaseReminder)