Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent auto-creation of Deleted Records #6002

Open
Bonapara opened this issue Jun 24, 2024 · 1 comment
Open

Prevent auto-creation of Deleted Records #6002

Bonapara opened this issue Jun 24, 2024 · 1 comment
Labels
blocked: tech spec needed scope: backend Issues that are affecting the backend side only size: hours

Comments

@Bonapara
Copy link
Member

Current Behavior

Deleting a Person/Company record that the email/calendar integration has automatically imported will result in it being reimported during the next import.

Desired Behavior

We should leverage the soft-delete feature to prevent the email from being imported again.

@Bonapara Bonapara added scope: backend Issues that are affecting the backend side only blocked: tech spec needed size: hours labels Jun 24, 2024
Copy link

greptile-apps bot commented Jun 24, 2024

To prevent re-importing deleted records, follow these steps:

  1. Modify Import Service: Update the import service to check for soft-deleted records before importing.

    File: services/importService.js

    const isSoftDeleted = await checkIfSoftDeleted(record);
    if (isSoftDeleted) {
      continue; // Skip re-importing
    }
  2. Update Soft Delete Check: Implement the checkIfSoftDeleted function to verify if a record is soft-deleted.

    File: utils/softDeleteUtils.js

    async function checkIfSoftDeleted(record) {
      // Logic to check if the record is soft-deleted
      const deletedRecord = await db.find({ id: record.id, deleted: true });
      return !!deletedRecord;
    }
  3. Adjust Listeners: Ensure listeners that trigger imports also respect the soft-delete status.

    File: listeners/importListeners.js

    import { checkIfSoftDeleted } from '../utils/softDeleteUtils';
    // Use checkIfSoftDeleted before processing import

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: tech spec needed scope: backend Issues that are affecting the backend side only size: hours
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant