Search posts, tags, users, and pages
A complete beginner to advance guide.
Abhishek Kumar
@Abhishek30 · India
Software Engineering | Full-Stack Web Development | JavaScript
I am Full-Stack Web Developer.
Markdown supported · ⌘↵ to post
Narayana M V L
Nice Explanation Adhi, Just want to Add support for custom where clauses:
async destroy(data, whereClause = {}) { const response = await this.model.destroy({ where: { id: data, ...whereClause, }, }); if (!response) { throw new AppError('Not able to find the resource', StatusCodes.NOT_FOUND); } return response; }
This allows users to specify additional conditions for deletion besides the primary key.
++
SUYASH MISHRA
Thanks for wonderful explanation
21UCS037 SADHANA SHARMA
Thanks for the elaborative explanation author 🚀✨Keep writing such amazing articles
Thanks reader for this beautiful comment ❤️
Akshat Awasthi
Nicely explained
Govind Singh
Loved it.
Narayana M V L
Nice Explanation Adhi, Just want to Add support for custom where clauses:
async destroy(data, whereClause = {}) { const response = await this.model.destroy({ where: { id: data, ...whereClause, }, }); if (!response) { throw new AppError('Not able to find the resource', StatusCodes.NOT_FOUND); } return response; }
This allows users to specify additional conditions for deletion besides the primary key.