Skip to content

refactor(dal): remove soft delete in message collection #8073

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

Conversation

djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Apr 7, 2025

- Updated message deletion methods to use a single delete operation instead of deleteMany.
- Removed the 'deleted' field from various DTOs and entities as part of the cleanup.
- Enhanced the update services to handle message removal more efficiently.
- Added enforcement of environment ID in message deletion queries.
- Cleaned up imports and adjusted return types for consistency.
Copy link

linear bot commented Apr 7, 2025

Copy link

pkg-pr-new bot commented Apr 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/novuhq/novu@8073
npm i https://pkg.pr.new/novuhq/novu/@novu/providers@8073
npm i https://pkg.pr.new/novuhq/novu/@novu/shared@8073

commit: dc5b556

Copy link

netlify bot commented Apr 7, 2025

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit dc5b556
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/67fe5b2a48eddf00085c73d6
😎 Deploy Preview https://deploy-preview-8073.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines +125 to +139
messageSchema.pre('find', function filterDeletedFind() {
this.where({ deleted: { $ne: true } });
});
messageSchema.pre('findOne', function filterDeletedFindOne() {
this.where({ deleted: { $ne: true } });
});
messageSchema.pre('findOneAndUpdate', function filterDeletedFindOneAndUpdate() {
this.where({ deleted: { $ne: true } });
});
messageSchema.pre('countDocuments', function filterDeletedCountDocuments() {
this.where({ deleted: { $ne: true } });
});
messageSchema.pre('count', function filterDeletedCount() {
this.where({ deleted: { $ne: true } });
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to verify, that's the proper syntax? Just looks a bit weird. Shouldn't we return something here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is i tested it locally, but we will still need to double test in staging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this just adds another where clause right? Not overrides the existing one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

@djabarovgeorge djabarovgeorge merged commit e6e4faa into next Apr 15, 2025
16 of 17 checks passed
@djabarovgeorge djabarovgeorge deleted the nv-5647-investigate-high-response-time-with-usecounts-hook-soft-delete branch April 15, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants