fix(api): add deleteOne builtin protection

This commit is contained in:
yassinedorbozgithub 2025-05-23 15:56:08 +01:00
parent 2f5c85cb64
commit 3ff2b97221

View File

@ -555,8 +555,10 @@ export abstract class BaseRepository<
} }
async deleteOne(criteria: string | TFilterQuery<T>): Promise<DeleteResult> { async deleteOne(criteria: string | TFilterQuery<T>): Promise<DeleteResult> {
const filter = typeof criteria === 'string' ? { _id: criteria } : criteria;
return await this.model return await this.model
.deleteOne(typeof criteria === 'string' ? { _id: criteria } : criteria) .deleteOne({ ...filter, builtin: { $ne: true } })
.exec(); .exec();
} }